diff --git a/.npmignore b/.npmignore index a3ac57c..e5e8579 100644 --- a/.npmignore +++ b/.npmignore @@ -5,6 +5,7 @@ test/** coverage/** npm-debug.log +commitlint.config.js *.test.js .DS_Store @@ -13,3 +14,6 @@ npm-debug.log .babelrc .eslintignore .eslintrc + +!build/templates/** +!build/templates/**/.* diff --git a/.travis.yml b/.travis.yml index 195ca3b..f55c950 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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: @@ -20,5 +20,4 @@ jobs: after_script: greenkeeper-lockfile-upload - stage: deploy if: branch = master - before_script: npm run build script: npm run deploy diff --git a/package.json b/package.json index 797760f..a00b686 100644 --- a/package.json +++ b/package.json @@ -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'", diff --git a/src/fileWriters/writeTemplateDirectoryFiles.js b/src/fileWriters/writeTemplateDirectoryFiles.js index 6e4e9e8..d536587 100644 --- a/src/fileWriters/writeTemplateDirectoryFiles.js +++ b/src/fileWriters/writeTemplateDirectoryFiles.js @@ -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, diff --git a/src/templates/core/package.json b/src/templates/core/package.template.json similarity index 100% rename from src/templates/core/package.json rename to src/templates/core/package.template.json