Skip to content

Commit

Permalink
fix(build): rename package.json template
Browse files Browse the repository at this point in the history
  • Loading branch information
jaebradley committed Apr 20, 2018
1 parent 843676b commit 18f45c4
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 5 deletions.
4 changes: 4 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ test/**
coverage/**

npm-debug.log
commitlint.config.js
*.test.js

.DS_Store
Expand All @@ -13,3 +14,6 @@ npm-debug.log
.babelrc
.eslintignore
.eslintrc

!build/templates/**
!build/templates/**/.*
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ cache:
notifications:
email: true
node_js:
- '8'
- '8.9.3'
before_install:
- npm install -g npm@5
- npm install -g npm@5.6.0
- npm install -g greenkeeper-lockfile@1
jobs:
include:
Expand All @@ -20,5 +20,4 @@ jobs:
after_script: greenkeeper-lockfile-upload
- stage: deploy
if: branch = master
before_script: npm run build
script: npm run deploy
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"fruit": "build/index.js"
},
"scripts": {
"build": "rm -rf build/ && babel src/ --ignore src/templates -d build/ --delete-dir-on-start --copy-files --include-dotfiles",
"build": "rm -rf build/ && babel src/ -d build/ --ignore 'src/templates' --copy-files --include-dotfiles",
"codecov": "codecov",
"commitmsg": "commitlint -e $GIT_PARAMS",
"deploy": "npm run travis-deploy-once 'npm run semantic-release'",
Expand Down
13 changes: 12 additions & 1 deletion src/fileWriters/writeTemplateDirectoryFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,18 @@ const writeTemplateDirectoryFiles = async ({ location, destination, templateValu
const files = await globby(location, { dot: true });
files.forEach((file) => {
const relativeFilePath = path.relative(location, file);
const destinationFilePath = path.join(destination, relativeFilePath);

let destinationFilePath = path.join(destination, relativeFilePath);
// (Ass)uming that package.json will always be at base of destination
// I can't wait until I regret hard-coding this

// I need to do this because I have templated package.json
// npm actually won't package directories with invalid package.json files
// so I have to change the name to package.template.json
if (file.indexOf('package.template.json') >= 0) {
destinationFilePath = path.join(destination, 'package.json');
}

writeTemplateFile({
templateValues,
location: file,
Expand Down
File renamed without changes.

0 comments on commit 18f45c4

Please sign in to comment.