Skip to content

Commit

Permalink
v1.79.0 - windows compatibility for npm scripts
Browse files Browse the repository at this point in the history
-   Made the generated npm scripts compatible with Windows by use `printf` instead of `echo`
  • Loading branch information
balupton committed Oct 30, 2023
1 parent 1bcd5b3 commit a3f1be1
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 15 deletions.
4 changes: 4 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# History

## v1.79.0 2023 October 30

- Made the generated npm scripts compatible with Windows by use `printf` instead of `echo`

## v1.78.0 2023 October 30

- Updated dependencies, [base files](https://github.com/bevry/base), and [editions](https://editions.bevry.me) using [boundation](https://github.com/bevry/boundation)
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "boundation",
"version": "1.78.0",
"version": "1.79.0",
"description": "Automatic scaffolding and upgrading of your JavaScript ecosystem projects using Bevry's best practices",
"homepage": "https://github.com/bevry/boundation",
"license": "Artistic-2.0",
Expand Down Expand Up @@ -132,17 +132,17 @@
"scripts": {
"our:bin": "node ./bin.mjs",
"our:clean": "rm -Rf ./docs ./edition* ./es2015 ./es5 ./out ./.next",
"our:compile": "echo no need for this project",
"our:deploy": "echo no need for this project",
"our:compile": "printf '%s\n' 'no need for this project'",
"our:deploy": "printf '%s\n' 'no need for this project'",
"our:meta": "npm run our:meta:contributors && npm run our:meta:projectz",
"our:meta:contributors": "update-contributors",
"our:meta:projectz": "projectz compile",
"our:release": "npm run our:release:prepare && npm run our:release:check-changelog && npm run our:release:check-dirty && npm run our:release:tag && npm run our:release:push",
"our:release:check-changelog": "cat ./HISTORY.md | grep v$npm_package_version || (echo add a changelog entry for v$npm_package_version && exit -1)",
"our:release:check-changelog": "cat ./HISTORY.md | grep \"v$npm_package_version\" || (printf '%s\n' \"add a changelog entry for v$npm_package_version\" && exit -1)",
"our:release:check-dirty": "git diff --exit-code",
"our:release:prepare": "npm run our:clean && npm run our:compile && npm run our:test && npm run our:meta",
"our:release:push": "git push origin && git push origin --tags",
"our:release:tag": "export MESSAGE=$(cat ./HISTORY.md | sed -n \"/## v$npm_package_version/,/##/p\" | sed 's/## //' | awk 'NR>1{print buf}{buf = $0}') && test \"$MESSAGE\" || (echo 'proper changelog entry not found' && exit -1) && git tag v$npm_package_version -am \"$MESSAGE\"",
"our:release:tag": "export MESSAGE=$(cat ./HISTORY.md | sed -n \"/## v$npm_package_version/,/##/p\" | sed 's/## //' | awk 'NR>1{print buf}{buf = $0}') && test \"$MESSAGE\" || (printf '%s\n' 'proper changelog entry not found' && exit -1) && git tag \"v$npm_package_version\" -am \"$MESSAGE\"",
"our:setup": "npm run our:setup:install",
"our:setup:install": "npm install",
"our:test": "npm run our:verify && npm test",
Expand Down
4 changes: 2 additions & 2 deletions source/editions.js
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ export function updateEditionFields(state) {
const packageType = has(edition.tags, 'require') ? 'commonjs' : 'module'
edition.scripts[
compileScriptName
] += ` && echo '{"type": "${packageType}"}' > ${edition.directory}/package.json`
] += ` && printf '%s' '{"type": "${packageType}"}' > ${edition.directory}/package.json`
}

// ensure description exists
Expand Down Expand Up @@ -745,7 +745,7 @@ export async function scaffoldEditions(state) {
answers.keywords.delete('export-default')
if (answers.sourceModule) {
try {
await exec(`cat ${sourceEdition.indexPath} | grep "export default"`)
await exec(`cat ${sourceEdition.indexPath} | grep 'export default'`)
exportDefault = true
answers.keywords.add('export-default')
} catch (err) {}
Expand Down
8 changes: 3 additions & 5 deletions source/runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -408,11 +408,9 @@ export async function updateRuntime(state) {
// add our package scripts
if (answers.npm)
Object.assign(state.scripts, {
'our:release:check-changelog':
'cat ./HISTORY.md | grep v$npm_package_version || (echo add a changelog entry for v$npm_package_version && exit -1)',
'our:release:check-changelog': `cat ./HISTORY.md | grep "v$npm_package_version" || (printf '%s\n' "add a changelog entry for v$npm_package_version" && exit -1)`,
'our:release:check-dirty': 'git diff --exit-code',
'our:release:tag':
'export MESSAGE=$(cat ./HISTORY.md | sed -n "/## v$npm_package_version/,/##/p" | sed \'s/## //\' | awk \'NR>1{print buf}{buf = $0}\') && test "$MESSAGE" || (echo \'proper changelog entry not found\' && exit -1) && git tag v$npm_package_version -am "$MESSAGE"',
'our:release:tag': `export MESSAGE=$(cat ./HISTORY.md | sed -n "/## v$npm_package_version/,/##/p" | sed 's/## //' | awk 'NR>1{print buf}{buf = $0}') && test "$MESSAGE" || (printf '%s\n' 'proper changelog entry not found' && exit -1) && git tag "v$npm_package_version" -am "$MESSAGE"`,
'our:release:push': 'git push origin && git push origin --tags',
'our:release': [
[...run, 'our:release:prepare'],
Expand Down Expand Up @@ -448,7 +446,7 @@ export async function updateRuntime(state) {
if (answers.languages.includes('css')) {
if (answers.vercelWebsite) {
state.scripts['our:verify:stylelint'] =
"echo 'disabled due to https://spectrum.chat/zeit/general/resolved-deployments-fail-with-enospc-no-space-left-on-device-write~d1b9f61a-65e8-42a3-9042-f9c6a6fae6fd'"
"printf '%s\n' 'disabled due to https://spectrum.chat/zeit/general/resolved-deployments-fail-with-enospc-no-space-left-on-device-write~d1b9f61a-65e8-42a3-9042-f9c6a6fae6fd'"
} else {
packages.stylelint = 'dev'
packages['stylelint-config-prettier'] = packages[
Expand Down
2 changes: 1 addition & 1 deletion source/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ export function repoToProject(input = '') {
return (input && repoToSlug(input).split('/')[1]) || ''
}

export const defaultScript = 'echo no need for this project'
export const defaultScript = "printf '%s\n' 'no need for this project'"

export const defaultDeploy =
'npm run our:compile && npm run our:test && npm run our:deploy'
Expand Down

0 comments on commit a3f1be1

Please sign in to comment.