quackage 1.0.14 → 1.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.quackage-templates.json +56 -2
- package/.vscode/settings.json +8 -0
- package/package.json +6 -6
- package/source/Default-Quackage-Configuration.json +3 -1
- package/source/Quackage.js +1 -0
- package/source/commands/Quackage-Command-Boilerplate.js +10 -5
- package/source/commands/Quackage-Command-BuildTemplates.js +18 -3
- package/source/commands/Quackage-Command-ListTemplates.js +111 -0
- package/source/services/Pict-Service-CommandLineUtility.js +3 -3
- package/templates/luxury/.config/code-server/config.yaml +4 -0
- package/templates/luxury/.vscode/launch.json +46 -0
- package/templates/luxury/Dockerfile_LUXURYCode +69 -0
- package/templates/luxury-mysql/.config/MySQL-Laden-Entry.sh +17 -0
- package/templates/luxury-mysql/.config/MySQL-Security.sql +5 -0
- package/templates/luxury-mysql/.config/code-server/config.yaml +4 -0
- package/templates/luxury-mysql/.vscode/launch.json +46 -0
- package/templates/luxury-mysql/Dockerfile_LUXURYCode +101 -0
- package/source/commands/Quackage-Command-BuildQuackageTemplates.js +0 -156
- /package/templates/pictunittest/test/{Pict_QUACKAGEPROJECTNAMECAP_test.js → Pict_QUACKAGEPROJECTNAMECAP_QUACKAGESCOPE_test.js} +0 -0
package/.quackage-templates.json
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
"Description": "A template set for pictunittest ...",
|
|
6
6
|
"Files": [
|
|
7
7
|
{
|
|
8
|
-
"Hash": "
|
|
9
|
-
"Path": "test/
|
|
8
|
+
"Hash": "testPictQUACKAGEPROJECTNAMECAPQUACKAGESCOPEtestjs",
|
|
9
|
+
"Path": "test/Pict_QUACKAGEPROJECTNAMECAP_QUACKAGESCOPE_test.js",
|
|
10
10
|
"Content": "/*\n\tUnit tests for LIBRARYNAMEHERE Basic\n*/\n\nconst _Package = require(`../package.json`);\n\n// This is temporary, but enables unit tests\nconst libBrowserEnv = require('browser-env')\nlibBrowserEnv();\n\nconst Chai = require('chai');\nconst Expect = Chai.expect;\n\nconst libPict = require('pict');\n\nconst configureTestPict = (pPict) =>\n{\n\tlet tmpPict = (typeof(pPict) == 'undefined') ? new libPict() : pPict;\n\ttmpPict.TestData = (\n\t\t{\n\t\t\tReads: [],\n\t\t\tAssignments: [],\n\t\t\tAppends: [],\n\t\t\tGets: []\n\t\t});\n\ttmpPict.ContentAssignment.customReadFunction = (pAddress, pContentType) =>\n\t{\n\t\ttmpPict.TestData.Reads.push(pAddress);\n\t\ttmpPict.log.info(`Mocking a read of type ${pContentType} from Address: ${pAddress}`);\n\t\treturn '';\n\t}\n\ttmpPict.ContentAssignment.customGetElementFunction = (pAddress) =>\n\t{\n\t\ttmpPict.TestData.Gets.push(pAddress);\n\t\ttmpPict.log.info(`Mocking a get of Address: ${pAddress}`);\n\t\treturn '';\n\t}\n\ttmpPict.ContentAssignment.customAppendElementFunction = (pAddress, pContent) =>\n\t{\n\t\ttmpPict.TestData.Appends.push(pAddress);\n\t\ttmpPict.log.info(`Mocking an append of Address: ${pAddress}`, {Content: pContent});\n\t\treturn '';\n\t}\n\ttmpPict.ContentAssignment.customAssignFunction = (pAddress, pContent) =>\n\t{\n\t\ttmpPict.TestData.Assignments.push(pAddress);\n\t\ttmpPict.log.info(`Mocking an assignment of Address: ${pAddress}`, {Content: pContent});\n\t\treturn '';\n\t}\n\n\treturn tmpPict;\n}\n\nconst libPictExtension = require(`../${_Package.main}`);\n\nsuite\n(\n\t`Basic ${_Package.name}v${_Package.version} tests`,\n\t() =>\n\t{\n\t\tsetup(() => { });\n\n\t\tsuite\n\t\t\t(\n\t\t\t\t'Basic Basic Tests',\n\t\t\t\t() =>\n\t\t\t\t{\n\t\t\t\t\ttest(\n\t\t\t\t\t\t\t'Constructor properly crafts an object',\n\t\t\t\t\t\t\t(fDone) =>\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlet _Pict = configureTestPict();\n\t\t\t\t\t\t\t\tlet _PictExtension = _Pict.addView({}, 'Pict-Test-{~RandomNumberString:4,9000~}', libPictExtension);\n\t\t\t\t\t\t\t\tExpect(_PictExtension).to.be.an('object');\n\t\t\t\t\t\t\t\treturn fDone();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t);\n\t}\n);"
|
|
11
11
|
}
|
|
12
12
|
]
|
|
@@ -54,5 +54,59 @@
|
|
|
54
54
|
"Content": "/*\n\tUnit tests for {~PascalCaseIdentifier:AppData.Package.name~} {~Data:Record.Scope~}\n*/\n\nconst Chai = require('chai');\nconst Expect = Chai.expect;\n\nconst lib{~PascalCaseIdentifier:AppData.Package.name~} = require(`../{~Data:AppData.Package.main~}`);\n\nsuite\n(\n\t'{~PascalCaseIdentifier:AppData.Package.name~} {~Data:Record.Scope~}',\n\t() =>\n\t{\n\t\tsetup(() => { });\n\n\t\tsuite\n\t\t\t(\n\t\t\t\t'Basic {~Data:Record.Scope~} Tests',\n\t\t\t\t() =>\n\t\t\t\t{\n\t\t\t\t\ttest(\n\t\t\t\t\t\t\t'Object Instantiation # {~RandomNumberString:1,9~}',\n\t\t\t\t\t\t\t(fDone) =>\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlet _{~PascalCaseIdentifier:AppData.Package.name~} = new lib{~PascalCaseIdentifier:AppData.Package.name~}();\n\t\t\t\t\t\t\t\tExpect(_{~PascalCaseIdentifier:AppData.Package.name~}).to.be.an('object');\n\t\t\t\t\t\t\t\treturn fDone();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t);\n\t}\n);"
|
|
55
55
|
}
|
|
56
56
|
]
|
|
57
|
+
},
|
|
58
|
+
"luxury": {
|
|
59
|
+
"Hash": "luxury",
|
|
60
|
+
"Name": "Luxury",
|
|
61
|
+
"Description": "A template set for luxury ...",
|
|
62
|
+
"Files": [
|
|
63
|
+
{
|
|
64
|
+
"Hash": "configcodeserverconfigyaml",
|
|
65
|
+
"Path": ".config/code-server/config.yaml",
|
|
66
|
+
"Content": "bind-addr: 127.0.0.1:8080\nauth: password\npassword: luxury\ncert: false\n"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"Hash": "vscodelaunchjson",
|
|
70
|
+
"Path": ".vscode/launch.json",
|
|
71
|
+
"Content": "{\n // Use IntelliSense to learn about possible attributes.\n // Hover to view descriptions of existing attributes.\n // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387\n \"version\": \"0.2.0\",\n \"configurations\": [\n {\n \"name\": \"Launch Debug Harness\",\n \"type\": \"pwa-node\",\n \"request\": \"launch\",\n \"outputCapture\": \"std\",\n \"skipFiles\": [\n \"<node_internals>/**\"\n ],\n \"program\": \"${workspaceFolder}/debug/Harness.js\",\n \"presentation\": {\n \"hidden\": false,\n \"group\": \"\",\n \"order\": 1\n }\n },\n {\n \"name\": \"Mocha Tests\",\n \"args\": [\n \"-u\",\n \"tdd\",\n \"--timeout\",\n \"999999\",\n \"--colors\",\n \"${workspaceFolder}/test\"\n ],\n \"internalConsoleOptions\": \"openOnSessionStart\",\n \"program\": \"${workspaceFolder}/node_modules/mocha/bin/_mocha\",\n \"request\": \"launch\",\n \"skipFiles\": [\n \"<node_internals>/**\"\n ],\n \"type\": \"pwa-node\",\n \"presentation\": {\n \"hidden\": false,\n \"group\": \"\",\n \"order\": 2\n }\n }\n ]\n}"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"Hash": "DockerfileLUXURYCode",
|
|
75
|
+
"Path": "Dockerfile_LUXURYCode",
|
|
76
|
+
"Content": "# Use the codercom/code-server image\nFROM codercom/code-server:latest\nLABEL org.opencontainers.image.authors=\"steven@velozo.com\"\n\nVOLUME /home/coder/.config\nVOLUME /home/coder/.vscode\n\nRUN echo \"...installing debian dependencies...\"\nRUN sudo apt update\nRUN sudo apt install vim curl tmux -y\n\nRUN echo \"Building development image...\"\n\nRUN echo \"...installing vscode extensions...\"\n\n# Mocha unit testing in the sidebar\nRUN code-server --install-extension hbenl.vscode-mocha-test-adapter\nRUN code-server --install-extension hbenl.test-adapter-converter\nRUN code-server --install-extension hbenl.vscode-test-explorer\n\n# Magic indentation rainbow\nRUN code-server --install-extension oderwat.indent-rainbow\nRUN code-server --install-extension dbaeumer.vscode-eslint\n\n# Contextual git\nRUN code-server --install-extension eamodio.gitlens\n\n# Other extensions (uncomment them to have them automagic, or run this from a terminal to install in the container):\n\n# Microsoft's AI code completion\n# RUN code-server --install-extension VisualStudioExptTeam.vscodeintellicode\n\n# Live server -- make sure to open up the port on the docker image\n# RUN code-server --install-extension ritwickdey.LiveServer\n\n# Quick link to required modules' documentation\n# RUN code-server --install-extension bengreenier.vscode-node-readme\n\n# Switch up fonts\n# RUN code-server --install-extension evan-buss.font-switcher\n\n# Icons\n# RUN code-server --install-extension vscode-icons-team.vscode-icons\n# RUN code-server --install-extension PKief.material-icon-theme\n\n# Hover over CSS colors to see them previewed\n# RUN code-server --install-extension bierner.color-info\n\n# An easy on the eyes color theme\n# RUN code-server --install-extension daylerees.rainglow\n\nRUN echo \"...mapping library specific volumes...\"\n\n# Volume mapping for code\nVOLUME /home/coder/{~D:AppData.Package.name~}\n\nSHELL [\"/bin/bash\", \"-c\"]\nUSER coder\n\nRUN echo \"...installing node version manager...\"\n# Because there is a .bashrc chicken/egg problem, we will create one here to simulate logging in. This is not great.\nRUN touch ~/.bashrc && chmod +x ~/.bashrc\nRUN curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash\n\nRUN echo \"...installing node version 14 as the default...\"\nRUN . ~/.nvm/nvm.sh && source ~/.bashrc && nvm install 14\nRUN . ~/.nvm/nvm.sh && source ~/.bashrc && nvm alias default 14\n\nWORKDIR /home/coder/{~D:AppData.Package.name~}\n"
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
},
|
|
80
|
+
"luxurymysql": {
|
|
81
|
+
"Hash": "luxurymysql",
|
|
82
|
+
"Name": "Luxurymysql",
|
|
83
|
+
"Description": "A template set for luxurymysql ...",
|
|
84
|
+
"Files": [
|
|
85
|
+
{
|
|
86
|
+
"Hash": "configMySQLLadenEntrysh",
|
|
87
|
+
"Path": ".config/MySQL-Laden-Entry.sh",
|
|
88
|
+
"Content": "#!/bin/bash\n\ntrap 'kill -TERM $PID' TERM INT\n\n/usr/bin/entrypoint.sh --bind-addr \"0.0.0.0:8080\" . &\n\nPID=$!\n\nsleep 2\n\nsudo service mariadb restart\n\nwait $PID\ntrap - TERM INT\nwait $PID\nEXIT_STATUS=$?\necho \"Service exited with status ${EXIT_STATUS}\""
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"Hash": "configMySQLSecuritysql",
|
|
92
|
+
"Path": ".config/MySQL-Security.sql",
|
|
93
|
+
"Content": "FLUSH PRIVILEGES;\n\nALTER USER 'root'@'localhost' IDENTIFIED BY '123456789';\n\nGRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456789' WITH GRANT OPTION;\n"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"Hash": "configcodeserverconfigyaml",
|
|
97
|
+
"Path": ".config/code-server/config.yaml",
|
|
98
|
+
"Content": "bind-addr: 127.0.0.1:8080\nauth: password\npassword: luxury\ncert: false\n"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"Hash": "vscodelaunchjson",
|
|
102
|
+
"Path": ".vscode/launch.json",
|
|
103
|
+
"Content": "{\n // Use IntelliSense to learn about possible attributes.\n // Hover to view descriptions of existing attributes.\n // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387\n \"version\": \"0.2.0\",\n \"configurations\": [\n {\n \"name\": \"Launch Debug Harness\",\n \"type\": \"pwa-node\",\n \"request\": \"launch\",\n \"outputCapture\": \"std\",\n \"skipFiles\": [\n \"<node_internals>/**\"\n ],\n \"program\": \"${workspaceFolder}/debug/Harness.js\",\n \"presentation\": {\n \"hidden\": false,\n \"group\": \"\",\n \"order\": 1\n }\n },\n {\n \"name\": \"Mocha Tests\",\n \"args\": [\n \"-u\",\n \"tdd\",\n \"--timeout\",\n \"999999\",\n \"--colors\",\n \"${workspaceFolder}/test\"\n ],\n \"internalConsoleOptions\": \"openOnSessionStart\",\n \"program\": \"${workspaceFolder}/node_modules/mocha/bin/_mocha\",\n \"request\": \"launch\",\n \"skipFiles\": [\n \"<node_internals>/**\"\n ],\n \"type\": \"pwa-node\",\n \"presentation\": {\n \"hidden\": false,\n \"group\": \"\",\n \"order\": 2\n }\n }\n ]\n}"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"Hash": "DockerfileLUXURYCode",
|
|
107
|
+
"Path": "Dockerfile_LUXURYCode",
|
|
108
|
+
"Content": "# Use the codercom/code-server image\nFROM codercom/code-server:latest\nMAINTAINER steven velozo\n\nVOLUME /home/coder/.config\nVOLUME /home/coder/.vscode\n\nRUN echo \"...installing debian dependencies...\"\nRUN sudo apt update\nRUN sudo apt install vim curl tmux -y\n\nRUN echo \"Building development image...\"\n\nRUN echo \"...installing vscode extensions...\"\n\n# Mocha unit testing in the sidebar\nRUN code-server --install-extension hbenl.vscode-mocha-test-adapter\nRUN code-server --install-extension hbenl.test-adapter-converter\nRUN code-server --install-extension hbenl.vscode-test-explorer\n\n# Magic indentation rainbow\nRUN code-server --install-extension oderwat.indent-rainbow\nRUN code-server --install-extension dbaeumer.vscode-eslint\n\n# Contextual git\nRUN code-server --install-extension eamodio.gitlens\n\n# SQL Tools\nRUN code-server --install-extension mtxr.sqltools\nRUN code-server --install-extension mtxr.sqltools-driver-mysql\n\n# >> Other extensions (uncomment them to have them automagic, or run this from a terminal to install in the container):\n\n# Microsoft's AI code completion\n# RUN code-server --install-extension VisualStudioExptTeam.vscodeintellicode\n\n# Live server -- make sure to open up the port on the docker image\n# RUN code-server --install-extension ritwickdey.LiveServer\n\n# Quick link to required modules' documentation\n# RUN code-server --install-extension bengreenier.vscode-node-readme\n\n# Switch up fonts\n# RUN code-server --install-extension evan-buss.font-switcher\n\n# Icons\n# RUN code-server --install-extension vscode-icons-team.vscode-icons\n# RUN code-server --install-extension PKief.material-icon-theme\n\n# Hover over CSS colors to see them previewed\n# RUN code-server --install-extension bierner.color-info\n\n# An easy on the eyes color theme\n# RUN code-server --install-extension daylerees.rainglow\n\nRUN echo \"...configuring mariadb (mysql) server...\"\nRUN sudo apt install default-mysql-server default-mysql-client -y\nRUN sudo sed -i \"s|bind-address|#bind-address|g\" /etc/mysql/mariadb.conf.d/50-server.cnf\n# This grants root everything in our test db instance\nCOPY ./.config/MySQL-Security.sql /home/coder/MySQL-Configure-Security.sql\n# This is the docker entrypoint that launches the SQL server in addition to the vscode stuff\nCOPY ./.config/MySQL-Laden-Entry.sh /usr/bin/MySQL-Laden-Entry.sh\nRUN sudo chmod +x /usr/bin/MySQL-Laden-Entry.sh\n# Launch the mysql server and execute the security grant with the client\nRUN ( sudo mysqld_safe --skip-grant-tables --skip-networking & ) && sleep 5 && mysql -u root < /home/coder/MySQL-Configure-Security.sql\n\n# Create the initial database ... you can change these luxurydb names to whatever you want\nRUN sudo service mariadb restart && sleep 5 && mysql -u root -p\"123456789\" -e \"CREATE DATABASE luxurydb;\"\n\n# You can follow these patterns below if you want to create a database and populate it with data.\n#\n# >> Put your table creation script here or change this, to import a database.\n# RUN echo \"...creating and populating database tables...\"\n# COPY ./.config/MySQL-Create-Database.mysql.sql /home/coder/MySQL-Create-Databases.sql\n# RUN sudo service mariadb restart && sleep 5 && mysql -u root -p\"123456789\" luxurydb < /home/coder/MySQL-Create-Databases.sql\n#\n# >> If you have a data population script, put it here.\n# COPY ./.config/MySQL-Populate-Database.mysql.sql /home/coder/MySQL-Populate-Database.sql\n# RUN sudo service mariadb restart && sleep 5 && mysql -u root -p\"123456789\" luxurydb < /home/coder/MySQL-Populate-Database.sql\n# RUN echo \"...database creation and population complmete.\"\n\nRUN echo \"...mapping library specific volumes...\"\n\n# Volume mapping for code\nVOLUME /home/coder/{~D:AppData.Package.name~}\n\nSHELL [\"/bin/bash\", \"-c\"]\nUSER coder\n\nRUN echo \"...installing node version manager...\"\n# Because there is a .bashrc chicken/egg problem, we will create one here to simulate logging in. This is not great.\nRUN touch ~/.bashrc && chmod +x ~/.bashrc\nRUN curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash\n\nRUN echo \"...installing node version 14 as the default...\"\nRUN . ~/.nvm/nvm.sh && source ~/.bashrc && nvm install 14\nRUN . ~/.nvm/nvm.sh && source ~/.bashrc && nvm alias default 14\n\nWORKDIR /home/coder/{~D:AppData.Package.name~}\n\nENTRYPOINT [\"/usr/bin/MySQL-Laden-Entry.sh\"]"
|
|
109
|
+
}
|
|
110
|
+
]
|
|
57
111
|
}
|
|
58
112
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quackage",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.15",
|
|
4
4
|
"description": "Building. Testing. Quacking.",
|
|
5
5
|
"main": "source/Quackage.js",
|
|
6
6
|
"scripts": {
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"./source/utility/Quackage-Execute-Process.js": "./source/utility/Quackage-Execute-Process-Base.js"
|
|
41
41
|
},
|
|
42
42
|
"keywords": [
|
|
43
|
-
"
|
|
44
|
-
"
|
|
43
|
+
"templates",
|
|
44
|
+
"metapackage"
|
|
45
45
|
],
|
|
46
46
|
"author": "Steven Velozo <steven@velozo.com> (http://velozo.com/)",
|
|
47
47
|
"license": "MIT",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
},
|
|
51
51
|
"homepage": "https://github.com/stevenvelozo/quackage",
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@babel/core": "^7.22.
|
|
54
|
-
"@babel/preset-env": "^7.22.
|
|
53
|
+
"@babel/core": "^7.22.5",
|
|
54
|
+
"@babel/preset-env": "^7.22.5",
|
|
55
55
|
"browserify": "^17.0.0",
|
|
56
56
|
"chai": "4.3.7",
|
|
57
57
|
"commander": "^10.0.1",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"mocha": "10.2.0",
|
|
64
64
|
"npm-check-updates": "^16.10.12",
|
|
65
65
|
"nyc": "^15.1.0",
|
|
66
|
-
"pict": "^1.0.
|
|
66
|
+
"pict": "^1.0.108",
|
|
67
67
|
"vinyl-buffer": "^1.0.1",
|
|
68
68
|
"vinyl-source-stream": "^2.0.0"
|
|
69
69
|
}
|
|
@@ -49,12 +49,14 @@
|
|
|
49
49
|
"start": "node {~Data:AppData.Package.main~}",
|
|
50
50
|
|
|
51
51
|
"test": "./node_modules/.bin/mocha -u tdd -R spec",
|
|
52
|
+
"tests": "./node_modules/mocha/bin/_mocha -u tdd --exit -R spec --grep",
|
|
53
|
+
|
|
52
54
|
"coverage": "./node_modules/.bin/nyc --reporter=lcov --reporter=text-lcov ./node_modules/mocha/bin/_mocha -- -u tdd -R spec",
|
|
53
55
|
|
|
54
56
|
"build": "npx quack build",
|
|
55
57
|
|
|
56
58
|
"docker-dev-build": "docker build ./ -f Dockerfile_LUXURYCode -t {~Data:AppData.Package.name~}-image:local",
|
|
57
|
-
"docker-dev-run": "docker run -it -d --name {~Data:AppData.Package.name~}-dev -p
|
|
59
|
+
"docker-dev-run": "docker run -it -d --name {~Data:AppData.Package.name~}-dev -p {~RandomNumber:10000,50000~}:8080 -p {~RandomNumber:10000,50000~}:8086 -v \"$PWD/.config:/home/coder/.config\" -v \"$PWD:/home/coder/{~Data:AppData.Package.name~}\" -u \"$(id -u):$(id -g)\" -e \"DOCKER_USER=$USER\" {~Data:AppData.Package.name~}-image:local",
|
|
58
60
|
"docker-dev-shell": "docker exec -it {~Data:AppData.Package.name~}-dev /bin/bash"
|
|
59
61
|
},
|
|
60
62
|
"CopyAfterBuild": [],
|
package/source/Quackage.js
CHANGED
|
@@ -61,6 +61,7 @@ finally
|
|
|
61
61
|
_Pict.CommandLineUtility.addCommandFromClass(require('./commands/Quackage-Command-Build.js'));
|
|
62
62
|
_Pict.CommandLineUtility.addCommandFromClass(require('./commands/Quackage-Command-Boilerplate.js'));
|
|
63
63
|
_Pict.CommandLineUtility.addCommandFromClass(require('./commands/Quackage-Command-BuildTemplates.js'));
|
|
64
|
+
_Pict.CommandLineUtility.addCommandFromClass(require('./commands/Quackage-Command-ListTemplates.js'));
|
|
64
65
|
|
|
65
66
|
console.log('')
|
|
66
67
|
_Pict.CommandLineUtility.run();
|
|
@@ -22,7 +22,15 @@ class QuackageCommandBoilerplate extends libCommandLineCommand
|
|
|
22
22
|
|
|
23
23
|
this.fable.TemplateProvider.addTemplate('PrototypePackage', JSON.stringify(this.fable.AppData.QuackagePackage, null, 4));
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
try
|
|
26
|
+
{
|
|
27
|
+
this.fileSet = require('../../.quackage-templates.json');
|
|
28
|
+
}
|
|
29
|
+
catch(pError)
|
|
30
|
+
{
|
|
31
|
+
this.fileSet = {};
|
|
32
|
+
this.fable.log.error(`Error loading .quackage-templates.json: ${pError.message}`);
|
|
33
|
+
}
|
|
26
34
|
|
|
27
35
|
// Auto add the command on initialization
|
|
28
36
|
this.addCommand();
|
|
@@ -132,7 +140,7 @@ class QuackageCommandBoilerplate extends libCommandLineCommand
|
|
|
132
140
|
let tmpFileFolder = libPath.dirname(tmpFilePath);
|
|
133
141
|
|
|
134
142
|
tmpFilePath = tmpFilePath.replace('QUACKAGEPROJECTNAMECAP', this.services.DataFormat.capitalizeEachWord(this.fable.AppData.Package.name))
|
|
135
|
-
|
|
143
|
+
.replace('QUACKAGESCOPE', tmpScope);
|
|
136
144
|
|
|
137
145
|
libFilePersistence.makeFolderRecursive(tmpFileFolder,
|
|
138
146
|
(pError)=>
|
|
@@ -140,7 +148,6 @@ class QuackageCommandBoilerplate extends libCommandLineCommand
|
|
|
140
148
|
if (pError)
|
|
141
149
|
{
|
|
142
150
|
this.log.error(`Error creating folder [${tmpFileFolder}] for boilerplate scope [${tmpScope}]: ${pError.message}`);
|
|
143
|
-
return fCallback(pError);
|
|
144
151
|
}
|
|
145
152
|
|
|
146
153
|
if (tmpBoilerPlateRecord.hasOwnProperty('options'))
|
|
@@ -168,8 +175,6 @@ class QuackageCommandBoilerplate extends libCommandLineCommand
|
|
|
168
175
|
{
|
|
169
176
|
return fCallback();
|
|
170
177
|
}
|
|
171
|
-
|
|
172
|
-
this.log.info(`Have a nice day!`);
|
|
173
178
|
});
|
|
174
179
|
|
|
175
180
|
}
|
|
@@ -91,7 +91,7 @@ class QuackageCommandBuildTemplates extends libCommandLineCommand
|
|
|
91
91
|
(pEnumerationError) =>
|
|
92
92
|
{
|
|
93
93
|
if (pEnumerationError)
|
|
94
|
-
return fCallback(`Error during
|
|
94
|
+
return fCallback(`Error during recursive template generation in folder [${pPath}]: ${pEnumerationError}`);
|
|
95
95
|
return fCallback();
|
|
96
96
|
});
|
|
97
97
|
});
|
|
@@ -135,7 +135,22 @@ class QuackageCommandBuildTemplates extends libCommandLineCommand
|
|
|
135
135
|
{
|
|
136
136
|
return fCallback(`Error building templates for ${pPath}: ${pEnumerationError}`, pEnumerationError);
|
|
137
137
|
}
|
|
138
|
-
|
|
138
|
+
let tmpExistingTemplateSets = {};
|
|
139
|
+
// Switch to merging templates
|
|
140
|
+
if (libFS.existsSync(`${this.fable.AppData.CWD}/.quackage-templates.json`))
|
|
141
|
+
{
|
|
142
|
+
try
|
|
143
|
+
{
|
|
144
|
+
let tmpExistingTemplateFile = libFS.readFileSync(`${this.fable.AppData.CWD}/.quackage-templates.json`, 'utf8');
|
|
145
|
+
tmpExistingTemplateSets = this.fable.Utility.extend({}, JSON.parse(tmpExistingTemplateFile));
|
|
146
|
+
}
|
|
147
|
+
catch (pError)
|
|
148
|
+
{
|
|
149
|
+
this.log.error(`Error reading existing .quackage-templates.json template file: ${pError}`);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
let tmpNewTemplateSets = this.fable.Utility.extend({}, tmpExistingTemplateSets, this.templateSets);
|
|
153
|
+
libFS.writeFileSync(`${this.fable.AppData.CWD}/.quackage-templates.json`, (JSON.stringify(tmpNewTemplateSets, null, 4)));
|
|
139
154
|
return fCallback();
|
|
140
155
|
});
|
|
141
156
|
});
|
|
@@ -146,7 +161,7 @@ class QuackageCommandBuildTemplates extends libCommandLineCommand
|
|
|
146
161
|
let tmpCallback = (typeof(fCallback) === 'function') ? fCallback : ()=>{};
|
|
147
162
|
let tmpCWDFolderPath = libPath.resolve(`${this.fable.AppData.CWD}/${pPath}`);
|
|
148
163
|
// Execute the command
|
|
149
|
-
this.log.info(`Creating
|
|
164
|
+
this.log.info(`Creating template(s) for [${tmpCWDFolderPath}] into "./quackage-templates.json"...`);
|
|
150
165
|
|
|
151
166
|
return this.generateTemplatesFromFolder(tmpCWDFolderPath, tmpCallback);
|
|
152
167
|
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
const libCommandLineCommand = require('../services/Pict-Service-CommandLineCommand.js');
|
|
2
|
+
const libOS = require('os');
|
|
3
|
+
const libPath = require('path');
|
|
4
|
+
|
|
5
|
+
class QuackageCommandBoilerplate extends libCommandLineCommand
|
|
6
|
+
{
|
|
7
|
+
constructor(pFable, pManifest, pServiceHash)
|
|
8
|
+
{
|
|
9
|
+
super(pFable, pManifest, pServiceHash);
|
|
10
|
+
|
|
11
|
+
this.options.CommandKeyword = 'listtemplates';
|
|
12
|
+
this.options.Description = 'List the available boilerplate template filesets in your user, local and the built-in .quackage-templates.json file(s).';
|
|
13
|
+
|
|
14
|
+
this.options.Aliases.push('list');
|
|
15
|
+
this.options.Aliases.push('lt');
|
|
16
|
+
|
|
17
|
+
this.fable.TemplateProvider.addTemplate('PrototypePackage', JSON.stringify(this.fable.AppData.QuackagePackage, null, 4));
|
|
18
|
+
|
|
19
|
+
try
|
|
20
|
+
{
|
|
21
|
+
this.fileSet = require('../../.quackage-templates.json');
|
|
22
|
+
}
|
|
23
|
+
catch(pError)
|
|
24
|
+
{
|
|
25
|
+
this.fileSet = {};
|
|
26
|
+
this.fable.log.error(`Error loading .quackage-templates.json: ${pError.message}`);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Auto add the command on initialization
|
|
30
|
+
this.addCommand();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
run(pFileset, pOptions, fCallback)
|
|
34
|
+
{
|
|
35
|
+
let tmpScope = pOptions.scope;
|
|
36
|
+
// Execute the command
|
|
37
|
+
this.log.info(`Creating boilerplate file(s) for [${pFileset}] Scoped as ${tmpScope}...`);
|
|
38
|
+
|
|
39
|
+
// Check if there is a .quackage-boilerplate.json in either the current directory or the user's home directory.
|
|
40
|
+
let tmpCWDFilesetPath = `${this.fable.AppData.CWD}/.quackage-templates.json`;
|
|
41
|
+
let tmpHomeFilesetPath = `${libOS.homedir()}/.quackage-templates.json`;
|
|
42
|
+
|
|
43
|
+
let libFilePersistence = this.services.FilePersistence;
|
|
44
|
+
|
|
45
|
+
if (libFilePersistence.existsSync(tmpCWDFilesetPath))
|
|
46
|
+
{
|
|
47
|
+
this.log.info(`Loading boilerplate fileset found in current directory: ${tmpCWDFilesetPath}`);
|
|
48
|
+
let tmpCWDFileset = false;
|
|
49
|
+
try
|
|
50
|
+
{
|
|
51
|
+
tmpCWDFileset = require(tmpCWDFilesetPath);
|
|
52
|
+
}
|
|
53
|
+
catch (pError)
|
|
54
|
+
{
|
|
55
|
+
this.log.error(`Error require loading boilerplate fileset from [${tmpCWDFilesetPath}]: ${pError.message}`);
|
|
56
|
+
}
|
|
57
|
+
finally
|
|
58
|
+
{
|
|
59
|
+
if (tmpCWDFileset)
|
|
60
|
+
{
|
|
61
|
+
this.log.info(`...Boilerplate fileset loaded from [${tmpCWDFilesetPath}]`);
|
|
62
|
+
this.log.info(`...Merging boilerplate fileset [${tmpCWDFilesetPath}] with [${pFileset}]`);
|
|
63
|
+
this.fileSet = this.services.Utility.extend(this.fileSet, tmpCWDFileset);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (libFilePersistence.existsSync(tmpHomeFilesetPath))
|
|
69
|
+
{
|
|
70
|
+
this.log.info(`Loading boilerplate fileset found in home directory: ${tmpHomeFilesetPath}`);
|
|
71
|
+
let tmpHomeFileset = false;
|
|
72
|
+
try
|
|
73
|
+
{
|
|
74
|
+
tmpHomeFileset = require(tmpHomeFilesetPath);
|
|
75
|
+
}
|
|
76
|
+
catch (pError)
|
|
77
|
+
{
|
|
78
|
+
this.log.error(`Error require loading boilerplate fileset from [${tmpHomeFilesetPath}]: ${pError.message}`);
|
|
79
|
+
}
|
|
80
|
+
finally
|
|
81
|
+
{
|
|
82
|
+
if (tmpHomeFileset)
|
|
83
|
+
{
|
|
84
|
+
this.log.info(`...Boilerplate fileset loaded from [${tmpHomeFilesetPath}]`);
|
|
85
|
+
this.log.info(`...Merging boilerplate fileset [${tmpHomeFilesetPath}] with [${pFileset}]`);
|
|
86
|
+
this.fileSet = this.services.Utility.extend(this.fileSet, tmpHomeFileset);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
let tmpFileSetKeys = Object.keys(this.fileSet);
|
|
92
|
+
|
|
93
|
+
if (tmpFileSetKeys.length === 0)
|
|
94
|
+
{
|
|
95
|
+
this.log.info(`No boilerplate template filesets found, which is odd because Quackage should have some built-in..`);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
for (let i = 0; i < tmpFileSetKeys.length; i++)
|
|
99
|
+
{
|
|
100
|
+
let tmpFileSetFileCount = this.fileSet[tmpFileSetKeys[i]].hasOwnProperty('Files') ? this.fileSet[tmpFileSetKeys[i]].Files.length : 0;
|
|
101
|
+
this.log.info(`${this.fable.DataFormat.stringPadEnd(tmpFileSetKeys[i], 40, ' _')} (${tmpFileSetFileCount} templated files)`);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (typeof(fCallback) === 'function')
|
|
105
|
+
{
|
|
106
|
+
return fCallback();
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
module.exports = QuackageCommandBoilerplate;
|
|
@@ -23,9 +23,9 @@ class CommandLineUtility extends libPict.ServiceProviderBase
|
|
|
23
23
|
|
|
24
24
|
this._Command = new libCommander();
|
|
25
25
|
|
|
26
|
-
this._Command.name(this.options.Command)
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
this._Command.name(this.options.Command);
|
|
27
|
+
this._Command.description(this.options.Description)
|
|
28
|
+
this._Command.version(this.options.Version, '-v, --version', 'output the current version');
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
createCommand(pCommandName, pCommandDescription)
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
// Use IntelliSense to learn about possible attributes.
|
|
3
|
+
// Hover to view descriptions of existing attributes.
|
|
4
|
+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
5
|
+
"version": "0.2.0",
|
|
6
|
+
"configurations": [
|
|
7
|
+
{
|
|
8
|
+
"name": "Launch Debug Harness",
|
|
9
|
+
"type": "pwa-node",
|
|
10
|
+
"request": "launch",
|
|
11
|
+
"outputCapture": "std",
|
|
12
|
+
"skipFiles": [
|
|
13
|
+
"<node_internals>/**"
|
|
14
|
+
],
|
|
15
|
+
"program": "${workspaceFolder}/debug/Harness.js",
|
|
16
|
+
"presentation": {
|
|
17
|
+
"hidden": false,
|
|
18
|
+
"group": "",
|
|
19
|
+
"order": 1
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"name": "Mocha Tests",
|
|
24
|
+
"args": [
|
|
25
|
+
"-u",
|
|
26
|
+
"tdd",
|
|
27
|
+
"--timeout",
|
|
28
|
+
"999999",
|
|
29
|
+
"--colors",
|
|
30
|
+
"${workspaceFolder}/test"
|
|
31
|
+
],
|
|
32
|
+
"internalConsoleOptions": "openOnSessionStart",
|
|
33
|
+
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
|
|
34
|
+
"request": "launch",
|
|
35
|
+
"skipFiles": [
|
|
36
|
+
"<node_internals>/**"
|
|
37
|
+
],
|
|
38
|
+
"type": "pwa-node",
|
|
39
|
+
"presentation": {
|
|
40
|
+
"hidden": false,
|
|
41
|
+
"group": "",
|
|
42
|
+
"order": 2
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Use the codercom/code-server image
|
|
2
|
+
FROM codercom/code-server:latest
|
|
3
|
+
LABEL org.opencontainers.image.authors="steven@velozo.com"
|
|
4
|
+
|
|
5
|
+
VOLUME /home/coder/.config
|
|
6
|
+
VOLUME /home/coder/.vscode
|
|
7
|
+
|
|
8
|
+
RUN echo "...installing debian dependencies..."
|
|
9
|
+
RUN sudo apt update
|
|
10
|
+
RUN sudo apt install vim curl tmux -y
|
|
11
|
+
|
|
12
|
+
RUN echo "Building development image..."
|
|
13
|
+
|
|
14
|
+
RUN echo "...installing vscode extensions..."
|
|
15
|
+
|
|
16
|
+
# Mocha unit testing in the sidebar
|
|
17
|
+
RUN code-server --install-extension hbenl.vscode-mocha-test-adapter
|
|
18
|
+
RUN code-server --install-extension hbenl.test-adapter-converter
|
|
19
|
+
RUN code-server --install-extension hbenl.vscode-test-explorer
|
|
20
|
+
|
|
21
|
+
# Magic indentation rainbow
|
|
22
|
+
RUN code-server --install-extension oderwat.indent-rainbow
|
|
23
|
+
RUN code-server --install-extension dbaeumer.vscode-eslint
|
|
24
|
+
|
|
25
|
+
# Contextual git
|
|
26
|
+
RUN code-server --install-extension eamodio.gitlens
|
|
27
|
+
|
|
28
|
+
# Other extensions (uncomment them to have them automagic, or run this from a terminal to install in the container):
|
|
29
|
+
|
|
30
|
+
# Microsoft's AI code completion
|
|
31
|
+
# RUN code-server --install-extension VisualStudioExptTeam.vscodeintellicode
|
|
32
|
+
|
|
33
|
+
# Live server -- make sure to open up the port on the docker image
|
|
34
|
+
# RUN code-server --install-extension ritwickdey.LiveServer
|
|
35
|
+
|
|
36
|
+
# Quick link to required modules' documentation
|
|
37
|
+
# RUN code-server --install-extension bengreenier.vscode-node-readme
|
|
38
|
+
|
|
39
|
+
# Switch up fonts
|
|
40
|
+
# RUN code-server --install-extension evan-buss.font-switcher
|
|
41
|
+
|
|
42
|
+
# Icons
|
|
43
|
+
# RUN code-server --install-extension vscode-icons-team.vscode-icons
|
|
44
|
+
# RUN code-server --install-extension PKief.material-icon-theme
|
|
45
|
+
|
|
46
|
+
# Hover over CSS colors to see them previewed
|
|
47
|
+
# RUN code-server --install-extension bierner.color-info
|
|
48
|
+
|
|
49
|
+
# An easy on the eyes color theme
|
|
50
|
+
# RUN code-server --install-extension daylerees.rainglow
|
|
51
|
+
|
|
52
|
+
RUN echo "...mapping library specific volumes..."
|
|
53
|
+
|
|
54
|
+
# Volume mapping for code
|
|
55
|
+
VOLUME /home/coder/{~D:AppData.Package.name~}
|
|
56
|
+
|
|
57
|
+
SHELL ["/bin/bash", "-c"]
|
|
58
|
+
USER coder
|
|
59
|
+
|
|
60
|
+
RUN echo "...installing node version manager..."
|
|
61
|
+
# Because there is a .bashrc chicken/egg problem, we will create one here to simulate logging in. This is not great.
|
|
62
|
+
RUN touch ~/.bashrc && chmod +x ~/.bashrc
|
|
63
|
+
RUN curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
|
|
64
|
+
|
|
65
|
+
RUN echo "...installing node version 14 as the default..."
|
|
66
|
+
RUN . ~/.nvm/nvm.sh && source ~/.bashrc && nvm install 14
|
|
67
|
+
RUN . ~/.nvm/nvm.sh && source ~/.bashrc && nvm alias default 14
|
|
68
|
+
|
|
69
|
+
WORKDIR /home/coder/{~D:AppData.Package.name~}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
trap 'kill -TERM $PID' TERM INT
|
|
4
|
+
|
|
5
|
+
/usr/bin/entrypoint.sh --bind-addr "0.0.0.0:8080" . &
|
|
6
|
+
|
|
7
|
+
PID=$!
|
|
8
|
+
|
|
9
|
+
sleep 2
|
|
10
|
+
|
|
11
|
+
sudo service mariadb restart
|
|
12
|
+
|
|
13
|
+
wait $PID
|
|
14
|
+
trap - TERM INT
|
|
15
|
+
wait $PID
|
|
16
|
+
EXIT_STATUS=$?
|
|
17
|
+
echo "Service exited with status ${EXIT_STATUS}"
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
// Use IntelliSense to learn about possible attributes.
|
|
3
|
+
// Hover to view descriptions of existing attributes.
|
|
4
|
+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
5
|
+
"version": "0.2.0",
|
|
6
|
+
"configurations": [
|
|
7
|
+
{
|
|
8
|
+
"name": "Launch Debug Harness",
|
|
9
|
+
"type": "pwa-node",
|
|
10
|
+
"request": "launch",
|
|
11
|
+
"outputCapture": "std",
|
|
12
|
+
"skipFiles": [
|
|
13
|
+
"<node_internals>/**"
|
|
14
|
+
],
|
|
15
|
+
"program": "${workspaceFolder}/debug/Harness.js",
|
|
16
|
+
"presentation": {
|
|
17
|
+
"hidden": false,
|
|
18
|
+
"group": "",
|
|
19
|
+
"order": 1
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"name": "Mocha Tests",
|
|
24
|
+
"args": [
|
|
25
|
+
"-u",
|
|
26
|
+
"tdd",
|
|
27
|
+
"--timeout",
|
|
28
|
+
"999999",
|
|
29
|
+
"--colors",
|
|
30
|
+
"${workspaceFolder}/test"
|
|
31
|
+
],
|
|
32
|
+
"internalConsoleOptions": "openOnSessionStart",
|
|
33
|
+
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
|
|
34
|
+
"request": "launch",
|
|
35
|
+
"skipFiles": [
|
|
36
|
+
"<node_internals>/**"
|
|
37
|
+
],
|
|
38
|
+
"type": "pwa-node",
|
|
39
|
+
"presentation": {
|
|
40
|
+
"hidden": false,
|
|
41
|
+
"group": "",
|
|
42
|
+
"order": 2
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Use the codercom/code-server image
|
|
2
|
+
FROM codercom/code-server:latest
|
|
3
|
+
MAINTAINER steven velozo
|
|
4
|
+
|
|
5
|
+
VOLUME /home/coder/.config
|
|
6
|
+
VOLUME /home/coder/.vscode
|
|
7
|
+
|
|
8
|
+
RUN echo "...installing debian dependencies..."
|
|
9
|
+
RUN sudo apt update
|
|
10
|
+
RUN sudo apt install vim curl tmux -y
|
|
11
|
+
|
|
12
|
+
RUN echo "Building development image..."
|
|
13
|
+
|
|
14
|
+
RUN echo "...installing vscode extensions..."
|
|
15
|
+
|
|
16
|
+
# Mocha unit testing in the sidebar
|
|
17
|
+
RUN code-server --install-extension hbenl.vscode-mocha-test-adapter
|
|
18
|
+
RUN code-server --install-extension hbenl.test-adapter-converter
|
|
19
|
+
RUN code-server --install-extension hbenl.vscode-test-explorer
|
|
20
|
+
|
|
21
|
+
# Magic indentation rainbow
|
|
22
|
+
RUN code-server --install-extension oderwat.indent-rainbow
|
|
23
|
+
RUN code-server --install-extension dbaeumer.vscode-eslint
|
|
24
|
+
|
|
25
|
+
# Contextual git
|
|
26
|
+
RUN code-server --install-extension eamodio.gitlens
|
|
27
|
+
|
|
28
|
+
# SQL Tools
|
|
29
|
+
RUN code-server --install-extension mtxr.sqltools
|
|
30
|
+
RUN code-server --install-extension mtxr.sqltools-driver-mysql
|
|
31
|
+
|
|
32
|
+
# >> Other extensions (uncomment them to have them automagic, or run this from a terminal to install in the container):
|
|
33
|
+
|
|
34
|
+
# Microsoft's AI code completion
|
|
35
|
+
# RUN code-server --install-extension VisualStudioExptTeam.vscodeintellicode
|
|
36
|
+
|
|
37
|
+
# Live server -- make sure to open up the port on the docker image
|
|
38
|
+
# RUN code-server --install-extension ritwickdey.LiveServer
|
|
39
|
+
|
|
40
|
+
# Quick link to required modules' documentation
|
|
41
|
+
# RUN code-server --install-extension bengreenier.vscode-node-readme
|
|
42
|
+
|
|
43
|
+
# Switch up fonts
|
|
44
|
+
# RUN code-server --install-extension evan-buss.font-switcher
|
|
45
|
+
|
|
46
|
+
# Icons
|
|
47
|
+
# RUN code-server --install-extension vscode-icons-team.vscode-icons
|
|
48
|
+
# RUN code-server --install-extension PKief.material-icon-theme
|
|
49
|
+
|
|
50
|
+
# Hover over CSS colors to see them previewed
|
|
51
|
+
# RUN code-server --install-extension bierner.color-info
|
|
52
|
+
|
|
53
|
+
# An easy on the eyes color theme
|
|
54
|
+
# RUN code-server --install-extension daylerees.rainglow
|
|
55
|
+
|
|
56
|
+
RUN echo "...configuring mariadb (mysql) server..."
|
|
57
|
+
RUN sudo apt install default-mysql-server default-mysql-client -y
|
|
58
|
+
RUN sudo sed -i "s|bind-address|#bind-address|g" /etc/mysql/mariadb.conf.d/50-server.cnf
|
|
59
|
+
# This grants root everything in our test db instance
|
|
60
|
+
COPY ./.config/MySQL-Security.sql /home/coder/MySQL-Configure-Security.sql
|
|
61
|
+
# This is the docker entrypoint that launches the SQL server in addition to the vscode stuff
|
|
62
|
+
COPY ./.config/MySQL-Laden-Entry.sh /usr/bin/MySQL-Laden-Entry.sh
|
|
63
|
+
RUN sudo chmod +x /usr/bin/MySQL-Laden-Entry.sh
|
|
64
|
+
# Launch the mysql server and execute the security grant with the client
|
|
65
|
+
RUN ( sudo mysqld_safe --skip-grant-tables --skip-networking & ) && sleep 5 && mysql -u root < /home/coder/MySQL-Configure-Security.sql
|
|
66
|
+
|
|
67
|
+
# Create the initial database ... you can change these luxurydb names to whatever you want
|
|
68
|
+
RUN sudo service mariadb restart && sleep 5 && mysql -u root -p"123456789" -e "CREATE DATABASE luxurydb;"
|
|
69
|
+
|
|
70
|
+
# You can follow these patterns below if you want to create a database and populate it with data.
|
|
71
|
+
#
|
|
72
|
+
# >> Put your table creation script here or change this, to import a database.
|
|
73
|
+
# RUN echo "...creating and populating database tables..."
|
|
74
|
+
# COPY ./.config/MySQL-Create-Database.mysql.sql /home/coder/MySQL-Create-Databases.sql
|
|
75
|
+
# RUN sudo service mariadb restart && sleep 5 && mysql -u root -p"123456789" luxurydb < /home/coder/MySQL-Create-Databases.sql
|
|
76
|
+
#
|
|
77
|
+
# >> If you have a data population script, put it here.
|
|
78
|
+
# COPY ./.config/MySQL-Populate-Database.mysql.sql /home/coder/MySQL-Populate-Database.sql
|
|
79
|
+
# RUN sudo service mariadb restart && sleep 5 && mysql -u root -p"123456789" luxurydb < /home/coder/MySQL-Populate-Database.sql
|
|
80
|
+
# RUN echo "...database creation and population complmete."
|
|
81
|
+
|
|
82
|
+
RUN echo "...mapping library specific volumes..."
|
|
83
|
+
|
|
84
|
+
# Volume mapping for code
|
|
85
|
+
VOLUME /home/coder/{~D:AppData.Package.name~}
|
|
86
|
+
|
|
87
|
+
SHELL ["/bin/bash", "-c"]
|
|
88
|
+
USER coder
|
|
89
|
+
|
|
90
|
+
RUN echo "...installing node version manager..."
|
|
91
|
+
# Because there is a .bashrc chicken/egg problem, we will create one here to simulate logging in. This is not great.
|
|
92
|
+
RUN touch ~/.bashrc && chmod +x ~/.bashrc
|
|
93
|
+
RUN curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
|
|
94
|
+
|
|
95
|
+
RUN echo "...installing node version 14 as the default..."
|
|
96
|
+
RUN . ~/.nvm/nvm.sh && source ~/.bashrc && nvm install 14
|
|
97
|
+
RUN . ~/.nvm/nvm.sh && source ~/.bashrc && nvm alias default 14
|
|
98
|
+
|
|
99
|
+
WORKDIR /home/coder/{~D:AppData.Package.name~}
|
|
100
|
+
|
|
101
|
+
ENTRYPOINT ["/usr/bin/MySQL-Laden-Entry.sh"]
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
const libCommandLineCommand = require('../services/Pict-Service-CommandLineCommand.js');
|
|
2
|
-
const libOS = require('os');
|
|
3
|
-
const libFS = require('fs');
|
|
4
|
-
const libPath = require('path');
|
|
5
|
-
|
|
6
|
-
class QuackageCommandBuildTemplates extends libCommandLineCommand
|
|
7
|
-
{
|
|
8
|
-
constructor(pFable, pManifest, pServiceHash)
|
|
9
|
-
{
|
|
10
|
-
super(pFable, pManifest, pServiceHash);
|
|
11
|
-
|
|
12
|
-
this.options.CommandKeyword = 'buildquackagetemplates';
|
|
13
|
-
this.options.Description = 'Generate boilerplate file set templates for each folder in the passed in path';
|
|
14
|
-
|
|
15
|
-
this.options.CommandArguments.push({ Name: '<folder>', Description: 'The folder path to build templates for.' });
|
|
16
|
-
this.options.Comma
|
|
17
|
-
|
|
18
|
-
this.options.Aliases.push('bqt');
|
|
19
|
-
|
|
20
|
-
this.templateSets = {};
|
|
21
|
-
|
|
22
|
-
// Auto add the command on initialization
|
|
23
|
-
this.addCommand();
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
getTemplateSet(pTemplateSetHash)
|
|
27
|
-
{
|
|
28
|
-
if (!this.templateSets.hasOwnProperty(pTemplateSetHash))
|
|
29
|
-
{
|
|
30
|
-
this.templateSets[pTemplateSetHash] = (
|
|
31
|
-
{
|
|
32
|
-
"Hash": this.services.DataFormat.cleanNonAlphaCharacters(pTemplateSetHash),
|
|
33
|
-
"Name": this.services.DataFormat.cleanNonAlphaCharacters(this.services.DataFormat.capitalizeEachWord(pTemplateSetHash)),
|
|
34
|
-
"Description": `A template set for ${pTemplateSetHash} ...`,
|
|
35
|
-
"Files": []
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return this.templateSets[pTemplateSetHash];
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
addTemplateToSet(pTemplateSetHash, pTemplateSetRootPath, pTemplateFilePath, pTemplateFileContent, fCallback)
|
|
43
|
-
{
|
|
44
|
-
let tmpTemplateSet = this.getTemplateSet(pTemplateSetHash);
|
|
45
|
-
let tmpTemplateFilePath = pTemplateFilePath;
|
|
46
|
-
|
|
47
|
-
if ((pTemplateSetRootPath.length > 0) && (pTemplateFilePath.length > pTemplateSetRootPath.length))
|
|
48
|
-
{
|
|
49
|
-
tmpTemplateFilePath = pTemplateFilePath.substr(pTemplateSetRootPath.length);
|
|
50
|
-
}
|
|
51
|
-
tmpTemplateFilePath = tmpTemplateFilePath.substr(1);
|
|
52
|
-
|
|
53
|
-
tmpTemplateSet.Files.push(
|
|
54
|
-
{
|
|
55
|
-
"Hash": this.services.DataFormat.cleanNonAlphaCharacters(tmpTemplateFilePath),
|
|
56
|
-
"Path": tmpTemplateFilePath,
|
|
57
|
-
"Content": pTemplateFileContent
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
return fCallback();
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
generateTemplatesRecursively(pTemplateSet, pTemplateSetRootPath, pPath, fCallback)
|
|
64
|
-
{
|
|
65
|
-
libFS.readdir(pPath,
|
|
66
|
-
(pError, pFiles) =>
|
|
67
|
-
{
|
|
68
|
-
this.fable.Utility.eachLimit(pFiles, 1,
|
|
69
|
-
(pFileName, fEnumerationComplete)=>
|
|
70
|
-
{
|
|
71
|
-
let tmpFilePath = libPath.join(pPath, pFileName);
|
|
72
|
-
let tmpStat = libFS.stat(tmpFilePath,
|
|
73
|
-
(pFileStatError, pFileStats) =>
|
|
74
|
-
{
|
|
75
|
-
if (pFileStatError)
|
|
76
|
-
{
|
|
77
|
-
return fEnumerationComplete('File stat error during enumeration:'+pEnumerationError);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
if (pFileStats && pFileStats.isDirectory())
|
|
81
|
-
{
|
|
82
|
-
return this.generateTemplatesRecursively(pTemplateSet, pTemplateSetRootPath, tmpFilePath, fEnumerationComplete);
|
|
83
|
-
}
|
|
84
|
-
else
|
|
85
|
-
{
|
|
86
|
-
this.log.info(`File [${pFileName}] in [${tmpFilePath}] is being added to template set: ${pTemplateSet}`);
|
|
87
|
-
let tmpFileContent = libFS.readFileSync(tmpFilePath, 'utf8');
|
|
88
|
-
return this.addTemplateToSet(pTemplateSet, pTemplateSetRootPath, tmpFilePath, tmpFileContent, fEnumerationComplete);
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
},
|
|
92
|
-
(pEnumerationError) =>
|
|
93
|
-
{
|
|
94
|
-
if (pEnumerationError)
|
|
95
|
-
return fCallback(`Error during bulk catalog of library [${pLibraryName}] folder [${pRelativeFolder}]: ${pEnumerationError}`);
|
|
96
|
-
return fCallback();
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
generateTemplatesFromFolder(pPath, fCallback)
|
|
102
|
-
{
|
|
103
|
-
libFS.readdir(pPath,
|
|
104
|
-
(pError, pFiles) =>
|
|
105
|
-
{
|
|
106
|
-
this.fable.Utility.eachLimit(pFiles, 1,
|
|
107
|
-
(pFileName, fEnumerationComplete)=>
|
|
108
|
-
{
|
|
109
|
-
let tmpFilePath = libPath.join(pPath, pFileName);
|
|
110
|
-
let tmpStat = libFS.stat(tmpFilePath,
|
|
111
|
-
(pFileStatError, pFileStats) =>
|
|
112
|
-
{
|
|
113
|
-
if (pFileStatError)
|
|
114
|
-
{
|
|
115
|
-
return fCallback('File stat error during enumeration:'+pEnumerationError);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
let tmpSetName = this.services.DataFormat.cleanNonAlphaCharacters(pFileName);
|
|
119
|
-
|
|
120
|
-
if (pFileStats && pFileStats.isDirectory())
|
|
121
|
-
{
|
|
122
|
-
this.log.info(`Root Directory [${tmpFilePath}] being added as its own template set.`);
|
|
123
|
-
this.generateTemplatesRecursively(tmpSetName, tmpFilePath, tmpFilePath, fEnumerationComplete);
|
|
124
|
-
}
|
|
125
|
-
else
|
|
126
|
-
{
|
|
127
|
-
this.log.info(`Root File [${tmpFilePath}] being added as its own template set.`);
|
|
128
|
-
let tmpFileContent = libFS.readFileSync(tmpFilePath, 'utf8');
|
|
129
|
-
return this.addTemplateToSet(tmpSetName, pPath, tmpFilePath, tmpFileContent, fEnumerationComplete);
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
},
|
|
133
|
-
(pEnumerationError) =>
|
|
134
|
-
{
|
|
135
|
-
if (pEnumerationError)
|
|
136
|
-
{
|
|
137
|
-
return fCallback(`Error building templates for ${pPath}: ${pEnumerationError}`, pEnumerationError);
|
|
138
|
-
}
|
|
139
|
-
libFS.writeFileSync(`${this.fable.AppData.CWD}/.quackage-templates.json`, (JSON.stringify(this.templateSets, null, 4)));
|
|
140
|
-
return fCallback();
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
run(pPath, pOptions, fCallback)
|
|
146
|
-
{
|
|
147
|
-
let tmpCallback = (typeof(fCallback) === 'function') ? fCallback : ()=>{};
|
|
148
|
-
let tmpCWDFolderPath = libPath.resolve(`${this.fable.AppData.CWD}/${pPath}`);
|
|
149
|
-
// Execute the command
|
|
150
|
-
this.log.info(`Creating boilerplate template(s) for [${tmpCWDFolderPath}]...`);
|
|
151
|
-
|
|
152
|
-
return this.generateTemplatesFromFolder(tmpCWDFolderPath, tmpCallback);
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
module.exports = QuackageCommandBuildTemplates;
|