Skip to content

Commit

Permalink
refactor: moved scripts to moon tasks to make it easy to test in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
GarthDB committed Mar 5, 2024
1 parent 30ab9ac commit a2b9d9f
Show file tree
Hide file tree
Showing 7 changed files with 184 additions and 97 deletions.
2 changes: 1 addition & 1 deletion .moon/toolchain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ $schema: 'https://moonrepo.dev/schemas/toolchain.json'
node:
# The version to use. Must be a semantic version that includes major, minor, and patch.
# We suggest using the latest active LTS version: https://nodejs.org/en/about/releases
version: '^20.0.0'
version: '20.0.0'

# The package manager to use when managing dependencies.
# Accepts "npm" (default), "pnpm", or "yarn".
Expand Down
107 changes: 106 additions & 1 deletion docs/ui/moon.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,108 @@
$schema: 'https://moonrepo.dev/schemas/project.json'
# Copyright 2023 Adobe. All rights reserved.
# This file is licensed to you under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. You may obtain a copy
# of the License at http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software distributed under
# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
# OF ANY KIND, either express or implied. See the License for the specific language
# governing permissions and limitations under the License.
$schema: https://moonrepo.dev/schemas/project.json
type: application
fileGroups:
sources:
- 'src/**/*'
output:
- 'dist/**/*'
dependsOn:
- contrast-colors
tasks:
makeDistDir:
command: 'mkdir -p dist'
platform: system
outputs:
- dist
dev:
command: 'parcel src/index.html src/theme.html src/scales.html src/tools.html src/demo.html --no-hmr'
platform: node
inputs:
- '@globs(sources)'
local: true
deps:
- ~:makeDistDir
- ~:copyWorkflowIcons
- ~:copyUIIcons
clean:
command: 'rm -rf dist/*'
platform: system
deps:
- ~:makeDistDir
local: true
copyWorkflowIcons:
command:
- cp
- -r
- node_modules/@adobe/spectrum-css-workflow-icons/dist/spectrum-icons.svg
- dist/
platform: system
deps:
- ~:makeDistDir
inputs:
- node_modules/@adobe/spectrum-css-workflow-icons/dist/spectrum-icons.svg
outputs:
- dist/spectrum-icons.svg
copyUIIcons:
command:
- cp
- -r
- node_modules/@spectrum-css/icon/dist/spectrum-css-icons.svg
- dist/
platform: system
deps:
- ~:makeDistDir
inputs:
- node_modules/@spectrum-css/icon/dist/spectrum-css-icons.svg
outputs:
- dist/spectrum-css-icons.svg
copyCNAME:
command:
- cp
- -r
- src/CNAME
- dist/CNAME
platform: system
deps:
- ~:makeDistDir
inputs:
- src/CNAME
outputs:
- dist/CNAME
buildSite:
command:
- parcel
- build
- --no-optimize
- src/index.html
- src/scales.html
- src/tools.html
- src/theme.html
- src/demo.html
- --public-url
- ./
platform: node
deps:
- ~:makeDistDir
- ~:copyCNAME
- ~:copyUIIcons
- ~:copyWorkflowIcons
inputs:
- '@globs(sources)'
outputs:
- '@globs(output)'
deploySite:
command: 'gh-pages -d dist'
platform: node
local: true
deps:
- ~:clean
- ~:buildSite
78 changes: 35 additions & 43 deletions docs/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,49 +5,6 @@
"description": "Demonstration UI for Leonardo",
"repository": "[email protected]:adobe/leonardo.git",
"author": "Nate Baldwin <[email protected]>",
"scripts": {
"serve": "pnpm parcel src/index.html src/theme.html src/scales.html src/tools.html src/demo.html --no-hmr",
"clean": "rm -rf dist/*",
"dev": "pnpm copyIcons && pnpm serve",
"copyIcons": "mkdir -p dist && pnpm copyWorkflowIcons && pnpm copyUIIcons",
"copyWorkflowIcons": "cp -r node_modules/@adobe/spectrum-css-workflow-icons/dist/spectrum-icons.svg dist/",
"copyUIIcons": "cp -r node_modules/@spectrum-css/icon/dist/spectrum-css-icons.svg dist/",
"copyCNAME": "cp -r src/CNAME dist/CNAME",
"postPublish": "pnpm deploySite",
"buildSite": "pnpm parcel build --no-optimize src/index.html src/scales.html src/tools.html src/theme.html src/demo.html --public-url ./ && pnpm copyCNAME && pnpm copyIcons",
"deploySite": "pnpm clean && pnpm buildSite && pnpm gh-pages -d dist"
},
"keywords": [
"accessibility",
"inclusive",
"wcag",
"contrast",
"color",
"contrast-ratio",
"a11y",
"luminance",
"relative-luminance",
"accessible",
"a11ycolor",
"colour",
"adaptive",
"adaptive-color",
"color-generator",
"contrast-generator",
"color-contrast-generator"
],
"license": "Apache-2.0",
"devDependencies": {
"@parcel/transformer-webmanifest": "^2.9.3",
"gh-pages": "^3.2.3",
"highlight.js": "^11.2.0",
"parcel": "^2.11.0",
"posthtml": "^0.16.5",
"posthtml-doctype": "^1.1.1",
"posthtml-include": "^1.7.2",
"posthtml-modules": "^0.7.4",
"sass": "^1.23.6"
},
"dependencies": {
"@adobe/focus-ring-polyfill": "^0.1.5",
"@adobe/leonardo-contrast-colors": "workspace:^",
Expand Down Expand Up @@ -115,5 +72,40 @@
"plotly.js-dist-min": "^2.5.1",
"posthtml-parser": "^0.10.1",
"simple-color-converter": "^2.1.13"
},
"keywords": [
"accessibility",
"inclusive",
"wcag",
"contrast",
"color",
"contrast-ratio",
"a11y",
"luminance",
"relative-luminance",
"accessible",
"a11ycolor",
"colour",
"adaptive",
"adaptive-color",
"color-generator",
"contrast-generator",
"color-contrast-generator"
],
"license": "Apache-2.0",
"devDependencies": {
"@parcel/transformer-webmanifest": "^2.9.3",
"buffer": "^5.5.0||^6.0.0",
"gh-pages": "^3.2.3",
"highlight.js": "^11.2.0",
"parcel": "^2.11.0",
"posthtml": "^0.16.5",
"posthtml-doctype": "^1.1.1",
"posthtml-include": "^1.7.2",
"posthtml-modules": "^0.7.4",
"path-browserify": "^1.0.0",
"process": "^0.11.10",
"sass": "^1.23.6",
"vm-browserify": "^1.1.2"
}
}
10 changes: 3 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,17 @@
"@changesets/cli": "^2.27.1",
"@commitlint/cli": "^18.4.3",
"@commitlint/config-conventional": "^18.4.3",
"@moonrepo/cli": "^1.18.1",
"@moonrepo/cli": "^1.22.4",
"@parcel/packager-raw-url": "2.11.0",
"@parcel/transformer-sass": "2.11.0",
"@parcel/transformer-webmanifest": "2.11.0",
"ava": "^6.0.1",
"buffer": "^5.5.0||^6.0.0",
"husky": "^8.0.3",
"lint-staged": "^15.2.0",
"path-browserify": "^1.0.0",
"prettier": "^3.1.1",
"process": "^0.11.10",
"vm-browserify": "^1.1.2"
"prettier": "^3.1.1"
},
"engines": {
"node": "^20.0.0"
"node": "20.0.0"
},
"packageManager": "[email protected]"
}
3 changes: 2 additions & 1 deletion packages/contrast-colors/moon.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
$schema: 'https://moonrepo.dev/schemas/project.json'
type: library

fileGroups:
sources:
- 'lib/**/*'
Expand All @@ -8,7 +10,6 @@ fileGroups:
tasks:
test:
command:
- npx
- ava
inputs:
- 'tasks/**/*'
Expand Down
4 changes: 0 additions & 4 deletions packages/contrast-colors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
"default": "./index.js"
}
},
"scripts": {
"dev": "pnpm ava --watch",
"test": "pnpm ava"
},
"author": "Nate Baldwin <[email protected]>",
"license": "Apache-2.0",
"dependencies": {
Expand Down
Loading

0 comments on commit a2b9d9f

Please sign in to comment.