Skip to content
This repository has been archived by the owner on May 9, 2022. It is now read-only.

Commit

Permalink
#45: packages/* refactored, so far seems to work: gradlew build, clea…
Browse files Browse the repository at this point in the history
…n, lint and test
  • Loading branch information
espen42 committed Mar 17, 2021
1 parent b7ba4d2 commit 0368853
Show file tree
Hide file tree
Showing 20 changed files with 110 additions and 27,406 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,10 @@
**/*.css.map


# Node modules
# Node modules folders
**/node_modules/
# Node modules symlinks
**/node_modules

# Visual studio code project files
**/bin/
Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type": "module",
"scripts": {
"_TEMP_DISABLED_version": "npm run test && lerna version --conventional-commits --exact && lerna run postversion && echo \"Versioning done, using conventional commits. Publish to NPM with: 'gradlew doPublish'.\"",
"setup": "npm i && npm run cleanNpm && npm run npmInstall",
"setup": "npm run npmInstall",
"npmInstall": "run-script-os",
"npmInstall:win32": "gradlew npmInstall --info",
"npmInstall:default": "./gradlew npmInstall --info",
Expand All @@ -22,14 +22,14 @@
"build": "run-script-os",
"build:win32": "gradlew build --info",
"build:default": "./gradlew build --info",
"npmLink": "npm run npmLinkBuildComponents && npm run npmLinkClient && npm run npmLinkConstants && npm run npmLinkExternals && npm run npmLinkNashornPolyfills && npm run npmLinkRegions && npm run npmLinkReact4xp",
"npmLinkBuildComponents": "node_modules/.bin/symlink-dir node_modules packages/buildcomponents/node_modules && node_modules/.bin/symlink-dir packages/buildcomponents node_modules/react4xp-build-components",
"npmLinkClient": "node_modules/.bin/symlink-dir node_modules packages/client/node_modules && node_modules/.bin/symlink-dir packages/client node_modules/react4xp-runtime-client",
"npmLinkConstants": "node_modules/.bin/symlink-dir node_modules packages/constants/node_modules && node_modules/.bin/symlink-dir packages/constants node_modules/react4xp-buildconstants",
"npmLinkExternals": "node_modules/.bin/symlink-dir node_modules packages/externals/node_modules && node_modules/.bin/symlink-dir packages/externals node_modules/react4xp-runtime-externals",
"npmLinkNashornPolyfills": "node_modules/.bin/symlink-dir node_modules packages/nashornpolyfills/node_modules && node_modules/.bin/symlink-dir packages/nashornpolyfills node_modules/react4xp-runtime-nashornpolyfills",
"npmLinkReact4xp": "node_modules/.bin/symlink-dir node_modules packages/react4xp/node_modules && node_modules/.bin/symlink-dir packages/react4xp node_modules/react4xp",
"npmLinkRegions": "node_modules/.bin/symlink-dir node_modules packages/regions/node_modules && node_modules/.bin/symlink-dir packages/regions node_modules/react4xp-regions"
"npmLink": "npm run npmLink:buildcomponents && npm run npmLink:client && npm run npmLink:constants && npm run npmLink:externals && npm run npmLink:nashornpolyfills && npm run npmLink:regions && npm run npmLink:react4xp",
"npmLink:buildcomponents": "node_modules/.bin/symlink-dir node_modules packages/buildcomponents/node_modules && node_modules/.bin/symlink-dir packages/buildcomponents node_modules/react4xp-build-components",
"npmLink:client": "node_modules/.bin/symlink-dir node_modules packages/client/node_modules && node_modules/.bin/symlink-dir packages/client node_modules/react4xp-runtime-client",
"npmLink:constants": "node_modules/.bin/symlink-dir node_modules packages/constants/node_modules && node_modules/.bin/symlink-dir packages/constants node_modules/react4xp-buildconstants",
"npmLink:externals": "node_modules/.bin/symlink-dir node_modules packages/externals/node_modules && node_modules/.bin/symlink-dir packages/externals node_modules/react4xp-runtime-externals",
"npmLink:nashornpolyfills": "node_modules/.bin/symlink-dir node_modules packages/nashornpolyfills/node_modules && node_modules/.bin/symlink-dir packages/nashornpolyfills node_modules/react4xp-runtime-nashornpolyfills",
"npmLink:regions": "node_modules/.bin/symlink-dir node_modules packages/regions/node_modules && node_modules/.bin/symlink-dir packages/regions node_modules/react4xp-regions",
"npmLink:react4xp": "node_modules/.bin/symlink-dir node_modules packages/react4xp/node_modules && node_modules/.bin/symlink-dir packages/react4xp node_modules/react4xp"
},
"author": "Espen Norderud",
"license": "Apache-2.0",
Expand Down
71 changes: 4 additions & 67 deletions packages/buildcomponents/build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
plugins {
// id "com.enonic.xp.app"
id "com.moowork.node"
}

/*dependencies {
include ":packages:constants"
include ":packages:regions"
}
app {
systemVersion = "${xpVersion}"
/*plugins {
id "com.moowork.node" // version "1.3.1"
}*/

cleanBuilt.delete './webpack.config.js', './build', './entriesandchunks.js', 'test/dummy-build', "test/output"
clean.delete './webpack.config.js', './build', './entriesandchunks.js', 'test/dummy-build', "test/output"

compileJS.args = ['run', 'babel']
compileJS.inputs.files('package.json', 'src/entriesandchunks.js')
Expand All @@ -36,10 +26,8 @@ task makeConstants(type: NodeTask) {
}
makeConstants.inputs.file('node_modules/react4xp-buildconstants/bin/cli.js')
makeConstants.outputs.dir('build')
makeConstants.dependsOn project.npmInstall

makeConstants.dependsOn copyFiles

makeConstants.dependsOn build

task testEntriesAndChunks(type: NpmTask) {
args=['run', 'test:entriesAndChunks']
Expand Down Expand Up @@ -70,56 +58,5 @@ testOverride.dependsOn copyFiles
test.outputs.dir('test/build')
test.outputs.dir('test/output')






task makeConstantsSubLink(type: NpmTask) {
args = ['link', 'react4xp-buildconstants']
}
makeConstantsSubLink.dependsOn ":packages:constants:npmLink"


task makeRegionsSubLink(type: NpmTask) {
args = ['link', 'react4xp-regions']
}
makeRegionsSubLink.dependsOn ":packages:regions:npmLink"


testEntriesAndChunks.dependsOn makeConstantsSubLink
testRaw.dependsOn makeConstantsSubLink
makeConstants.dependsOn makeConstantsSubLink
testOverride.dependsOn makeConstantsSubLink
makeConstantsSubLink.dependsOn npmInstall
testEntriesAndChunks.dependsOn makeRegionsSubLink
testRaw.dependsOn makeRegionsSubLink
makeConstants.dependsOn makeRegionsSubLink
testOverride.dependsOn makeRegionsSubLink
makeRegionsSubLink.dependsOn npmInstall

task makeMainLink(type: NpmTask) {
args = ['link']
doLast {
// Make marker
def linkMarkerName = "${project.ext.PROJDIR}node_modules/react4xp/npmLinked.marker"
def marker = new File(linkMarkerName)
new File(marker.getParent()).mkdirs()
marker.text = """
Marker file, indicating that react4xp in node_module is locally linked - faster than traversing node_modules.
"""
println "Created: $linkMarkerName"
}
}
task makeSubLinks {}
makeSubLinks.dependsOn makeConstantsSubLink
makeSubLinks.dependsOn makeRegionsSubLink

npmLink.dependsOn makeSubLinks
npmLink.dependsOn makeMainLink
makeSubLinks.mustRunAfter makeMainLink

npmLink.enabled = false

//doPublish.shouldRunAfter ":packages:constants:doPublish"
//doPublish.shouldRunAfter ":packages:regions:doPublish"
6 changes: 3 additions & 3 deletions packages/buildcomponents/package-lock.json

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

19 changes: 6 additions & 13 deletions packages/buildcomponents/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@
],
"scripts": {
"test:main": "echo \"(Placeholder necessary for task dependencies)\"",
"test:entriesAndChunks": "NODE_PATH=../.. npx mocha --require @babel/register --require @babel/polyfill --require test/test_helper.js \"test/**/*@(spec.js)\"",
"test:raw": "NODE_PATH=../.. npx webpack --config webpack.config.js --env.ENTRY_DIRS=entries --env.CHUNK_DIRS=sharedComps,redux --env.OVERRIDE_COMPONENT_WEBPACK=test/webpack.config.symlinks.override.js --env.REACT4XP_CONFIG_FILE=build/constants.json --env.VERBOSE=true ",
"test:override": "NODE_PATH=../.. npx webpack --config webpack.config.js --env.OVERRIDE_COMPONENT_WEBPACK=test/webpack.config.override.js --env.VERBOSE=true --env.REACT4XP_CONFIG_FILE=build/constants.json ",
"babel-min": "NODE_PATH=../.. npx babel src/entriesandchunks.js -o entriesandchunks.js --no-comments --minified --compact true",
"babel": "NODE_PATH=../.. npx babel src/entriesandchunks.js -o entriesandchunks.js --no-comments",
"lint": "NODE_PATH=. ../../node_modules/eslint/bin/eslint.js src/*.js --fix",
"nsi:install": "npm-safe-install",
"test:entriesAndChunks": "NODE_PATH=. npx mocha --require @babel/register --require @babel/polyfill --require test/test_helper.js \"test/**/*@(spec.js)\"",
"test:raw": "NODE_PATH=. npx webpack --config webpack.config.js --env.ENTRY_DIRS=entries --env.CHUNK_DIRS=sharedComps,redux --env.OVERRIDE_COMPONENT_WEBPACK=test/webpack.config.symlinks.override.js --env.REACT4XP_CONFIG_FILE=build/constants.json --env.VERBOSE=true ",
"test:override": "NODE_PATH=. npx webpack --config webpack.config.js --env.OVERRIDE_COMPONENT_WEBPACK=test/webpack.config.override.js --env.VERBOSE=true --env.REACT4XP_CONFIG_FILE=build/constants.json ",
"babel-min": "NODE_PATH=. npx babel src/entriesandchunks.js -o entriesandchunks.js --no-comments --minified --compact true",
"babel": "NODE_PATH=.npx babel src/entriesandchunks.js -o entriesandchunks.js --no-comments",
"lint": "NODE_PATH=. node_modules/eslint/bin/eslint.js src/*.js --fix",
"postversion": "cd ../.. && ./copytag.js buildcomponents"
},
"repository": {
Expand Down Expand Up @@ -52,12 +51,6 @@
"git add"
]
},
"husky": {
"hooks": {
"_TEMP_DISABLED_pre-commit": "lint-staged",
"pre-push": "npm run test"
}
},
"directories": {
"lib": "lib",
"test": "__tests__"
Expand Down
7 changes: 4 additions & 3 deletions packages/client/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
plugins {
/*plugins {
id "com.moowork.node" // version "1.3.1"
}
}*/

cleanBuilt.delete './react4xpClient.es6', './webpack.config.js', 'build', 'test/output'
clean.delete './react4xpClient.es6', './webpack.config.js', 'build', 'test/output'

compileJS.enabled = false

Expand Down Expand Up @@ -30,3 +30,4 @@ task copyFiles(type: Copy) {
copyFiles.inputs.dir('src')
copyFiles.outputs.files('./react4xpClient.es6', './webpack.config.js')
build.dependsOn project.copyFiles

Loading

0 comments on commit 0368853

Please sign in to comment.