Skip to content

Commit

Permalink
Idea #2 (Good) (#127) [Script consolidation, build order, link]
Browse files Browse the repository at this point in the history
* Build order

* Update all npm.nicfv package versions

* Update typedoc dependency

* Oh my gosh, this is so nice

* Clean up the `run` script a bit with the new npm scripts

* Minor comment fix

* Remove packed example on `npm stop`

* Actually increment package versions
  • Loading branch information
nicfv authored Dec 6, 2024
1 parent dddf7ed commit c658067
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 64 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/run
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ node -v || exit 1
npm -v || exit 1

# Run tests on ci workflow
npm run clean && npm i && npm test || exit 1
npm start || exit 1

# Check for and set npm token if publish flag is set
if [[ "${1}" == 'publish' ]] ; then
Expand Down Expand Up @@ -40,9 +40,7 @@ if [[ "${1}" == 'publish' ]] ; then
echo 'Package and changelog versions do not match!'
exit 1
fi
# Generate package and run all examples
echo 'Generating tarball...'
npm pack --pack-destination examples || exit 1
# Run all examples and generate output
cd examples && {
npm i || exit 1
for example in * ; do
Expand Down Expand Up @@ -74,8 +72,7 @@ if [[ "${1}" == 'publish' ]] ; then
echo "Skipping file ${example}"
fi
done
# Clean the project and reset the working directory
npm run clean || exit 1
# Reset the working directory
cd ..
} || exit 1
# Make sure that the local version number is higher before publishing
Expand Down
25 changes: 1 addition & 24 deletions .github/workflows/scripts
Original file line number Diff line number Diff line change
@@ -1,26 +1,3 @@
#!/usr/bin/env bash

clean=false
build=false
pack=false

while getopts ':cbp' opt ; do
case "${opt}" in
'c') clean=true ;;
'b') build=true ;;
'p') pack=true ;;
*) echo "Invalid option ${OPTARG}" && exit 1 ;;
esac
done

if "${build}" ; then
tsc && node dist/test.js && rm dist/test.js types/test.d.ts
fi

if "${pack}" ; then
npm pack --pack-destination examples
fi

if "${clean}" ; then
rm -rf dist types
fi
rm -rf dist types && tsc && node dist/test.js && rm dist/test.js types/test.d.ts && npm pack --pack-destination examples
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{
"scripts": {
"build": "npm run build --workspaces",
"test": "tsc -v && npm test --workspaces",
"docs": "typedoc",
"clean": "rm -rf packages/*/node_modules node_modules package-lock.json docs && npm run postpack --workspaces"
"start": "npm i && tsc -v && npm start --workspaces",
"stop": "rm -rf packages/*/node_modules packages/*/dist packages/*/types packages/*/examples/*.tgz node_modules package-lock.json docs",
"docs": "typedoc --version && typedoc"
},
"workspaces": [
"packages/t6",
"packages/smath",
"packages/*"
],
"devDependencies": {
"typedoc": "0.27.2",
"typedoc": "0.27.3",
"typescript": "5.7.2"
}
}
4 changes: 4 additions & 0 deletions packages/datafit/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 1.4.8

- This version is functionally identical to the previous, but is published as a test of the updated workflow, with a cleaned up `package.json` file

## 1.4.7

- Update typescript dependency version to 5.7.2
Expand Down
11 changes: 4 additions & 7 deletions packages/datafit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "datafit",
"version": "1.4.7",
"version": "1.4.8",
"description": "Simple curve-fitting algorithm",
"homepage": "https://npm.nicfv.com/",
"bin": "",
Expand All @@ -11,10 +11,7 @@
"types"
],
"scripts": {
"build": "npm run postpack && tsc && node dist/test.js && rm dist/test.js types/test.d.ts",
"test": "tsc --noEmit",
"prepack": "npm run build",
"postpack": "rm -rf dist types"
"start": "../../.github/workflows/scripts"
},
"keywords": [
"math",
Expand Down Expand Up @@ -49,9 +46,9 @@
"repository": "github:nicfv/npm",
"license": "MIT",
"dependencies": {
"smath": "1.9.0"
"smath": "1.9.2"
},
"devDependencies": {
"t6": "1.1.5"
"t6": "1.1.7"
}
}
5 changes: 1 addition & 4 deletions packages/dimensional/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@
"types"
],
"scripts": {
"build": "npm run postpack && tsc && node dist/test.js && rm dist/test.js types/test.d.ts",
"test": "tsc --noEmit",
"prepack": "npm run build",
"postpack": "rm -rf dist types"
"start": "../../.github/workflows/scripts"
},
"keywords": [
"quantity",
Expand Down
4 changes: 4 additions & 0 deletions packages/smath/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 1.9.2

- This version is functionally identical to the previous, but is published as a test of the updated workflow, with a cleaned up `package.json` file

## 1.9.1

- Publish with provenance
Expand Down
9 changes: 3 additions & 6 deletions packages/smath/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "smath",
"version": "1.9.1",
"version": "1.9.2",
"description": "Small math function library",
"homepage": "https://npm.nicfv.com/",
"bin": "dist/bin.js",
Expand All @@ -11,10 +11,7 @@
"types"
],
"scripts": {
"build": "npm run postpack && tsc && node dist/test.js && rm dist/test.js types/test.d.ts",
"test": "tsc --noEmit",
"prepack": "npm run build",
"postpack": "rm -rf dist types"
"start": "../../.github/workflows/scripts"
},
"keywords": [
"small",
Expand Down Expand Up @@ -56,6 +53,6 @@
"license": "MIT",
"devDependencies": {
"@types/node": "22.10.1",
"t6": "1.1.5"
"t6": "1.1.7"
}
}
4 changes: 4 additions & 0 deletions packages/t6/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 1.1.7

- This version is functionally identical to the previous, but is published as a test of the updated workflow, with a cleaned up `package.json` file

## 1.1.6

- Update typescript dependency version to 5.7.2
Expand Down
7 changes: 2 additions & 5 deletions packages/t6/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "t6",
"version": "1.1.6",
"version": "1.1.7",
"description": "Lightweight assertion testing framework",
"homepage": "https://npm.nicfv.com/",
"bin": "",
Expand All @@ -11,10 +11,7 @@
"types"
],
"scripts": {
"build": "npm run postpack && tsc && node dist/test.js && rm dist/test.js types/test.d.ts",
"test": "tsc --noEmit",
"prepack": "npm run build",
"postpack": "rm -rf dist types"
"start": "../../.github/workflows/scripts"
},
"keywords": [
"except",
Expand Down
4 changes: 4 additions & 0 deletions packages/viridis/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 1.1.7

- This version is functionally identical to the previous, but is published as a test of the updated workflow, with a cleaned up `package.json` file

## 1.1.6

- Update typescript dependency version to 5.7.2
Expand Down
11 changes: 4 additions & 7 deletions packages/viridis/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "viridis",
"version": "1.1.6",
"version": "1.1.7",
"description": "Color gradients for data visualization",
"homepage": "https://npm.nicfv.com/",
"bin": "",
Expand All @@ -11,10 +11,7 @@
"types"
],
"scripts": {
"build": "npm run postpack && tsc && node dist/test.js && rm dist/test.js types/test.d.ts",
"test": "tsc --noEmit",
"prepack": "npm run build",
"postpack": "rm -rf dist types"
"start": "../../.github/workflows/scripts"
},
"keywords": [
"color",
Expand All @@ -41,9 +38,9 @@
"repository": "github:nicfv/npm",
"license": "MIT",
"dependencies": {
"smath": "1.9.0"
"smath": "1.9.2"
},
"devDependencies": {
"t6": "1.1.5"
"t6": "1.1.7"
}
}

0 comments on commit c658067

Please sign in to comment.