vanilla-jet 1.0.27 → 1.0.29
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/.github/workflows/deploy.yml +58 -0
- package/.grunt/build_styles_task.js +16 -4
- package/.grunt/compile_html.js +1 -1
- package/.scripts/generate_packages_json.js +3 -4
- package/Gruntfile.js +66 -33
- package/bin.js +33 -4
- package/framework/dipper.js +5 -2
- package/framework/functions.js +1 -1
- package/package.json +2 -5
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
name: Publish to npm
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
release:
|
|
10
|
+
name: Publish
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
environment: rep
|
|
13
|
+
|
|
14
|
+
steps:
|
|
15
|
+
- name: Check out the repository
|
|
16
|
+
uses: actions/checkout@v3
|
|
17
|
+
|
|
18
|
+
- name: Setup Node.js
|
|
19
|
+
uses: actions/setup-node@v3
|
|
20
|
+
with:
|
|
21
|
+
node-version: '20'
|
|
22
|
+
registry-url: 'https://registry.npmjs.org/'
|
|
23
|
+
cache: 'npm'
|
|
24
|
+
|
|
25
|
+
- name: Install dependencies
|
|
26
|
+
run: npm install
|
|
27
|
+
|
|
28
|
+
- name: Publish to npm
|
|
29
|
+
env:
|
|
30
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
31
|
+
run: npm publish
|
|
32
|
+
|
|
33
|
+
- name: Configure git identity
|
|
34
|
+
run: |
|
|
35
|
+
git config --global user.email "actions@github.com"
|
|
36
|
+
git config --global user.name "GitHub Actions"
|
|
37
|
+
|
|
38
|
+
- name: Get version from package.json
|
|
39
|
+
id: get_version
|
|
40
|
+
run: echo "::set-output name=version::$(node -p "require('./package.json').version")"
|
|
41
|
+
|
|
42
|
+
- name: Check if tag exists
|
|
43
|
+
run: |
|
|
44
|
+
if git rev-parse v${{ steps.get_version.outputs.version }} >/dev/null 2>&1; then
|
|
45
|
+
echo "Tag v${{ steps.get_version.outputs.version }} already exists"
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
- name: Remove existing tag if exists
|
|
49
|
+
run: |
|
|
50
|
+
if git rev-parse v${{ steps.get_version.outputs.version }} >/dev/null 2>&1; then
|
|
51
|
+
git push --delete origin v${{ steps.get_version.outputs.version }}
|
|
52
|
+
git tag -d v${{ steps.get_version.outputs.version }}
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
- name: Create tag
|
|
56
|
+
run: |
|
|
57
|
+
git tag -a v${{ steps.get_version.outputs.version }} -m "Version ${{ steps.get_version.outputs.version }}"
|
|
58
|
+
git push origin v${{ steps.get_version.outputs.version }}
|
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
module.exports = function(grunt) {
|
|
2
2
|
grunt.registerTask('buildLess', 'Compile admin.less and add .section.less', function() {
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
// -- Functions
|
|
5
|
+
function getCleanedCWD() {
|
|
6
|
+
const cwd = process.cwd();
|
|
7
|
+
return cwd
|
|
8
|
+
.replace('/node_modules', '')
|
|
9
|
+
.replace('/vanilla-jet', '')
|
|
10
|
+
.replace('/.grunt', '');
|
|
11
|
+
}
|
|
12
|
+
console.log('cwd 1: ', getCleanedCWD());
|
|
13
|
+
|
|
14
|
+
// -- Content
|
|
15
|
+
let adminContent = grunt.file.read(`${getCleanedCWD()}/assets/styles/less/admin.less`);
|
|
4
16
|
let sectionFiles = grunt.file.expand([
|
|
5
|
-
|
|
6
|
-
|
|
17
|
+
`${getCleanedCWD()}/assets/styles/less/sections/**/*.section.less`,
|
|
18
|
+
`${getCleanedCWD()}/assets/styles/less/sections/*.section.less`
|
|
7
19
|
]);
|
|
8
20
|
|
|
9
21
|
let combinedContent = adminContent + '\n';
|
|
@@ -13,7 +25,7 @@ module.exports = function(grunt) {
|
|
|
13
25
|
});
|
|
14
26
|
|
|
15
27
|
// -- New file
|
|
16
|
-
grunt.file.write(
|
|
28
|
+
grunt.file.write(`${getCleanedCWD()}/assets/styles/less/admin_build.less`, combinedContent);
|
|
17
29
|
grunt.task.run(['less']);
|
|
18
30
|
});
|
|
19
31
|
};
|
package/.grunt/compile_html.js
CHANGED
|
@@ -201,7 +201,7 @@ async function createHTMLFile(content, filePath) {
|
|
|
201
201
|
fs.mkdirSync(publicPath, { recursive: true });
|
|
202
202
|
const absolutePath = path.join(publicPath, filePath);
|
|
203
203
|
fs.writeFileSync(absolutePath, minified, 'utf8');
|
|
204
|
-
console.log(`Html file created at: ${absolutePath}`);
|
|
204
|
+
console.log(`Html :) file created at: ${absolutePath}`);
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
// -- Helpers
|
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
const path = require("path"),
|
|
3
3
|
fs = require("fs");
|
|
4
4
|
|
|
5
|
-
// -- Call main
|
|
6
|
-
main();
|
|
7
|
-
|
|
8
5
|
// -- Main function
|
|
9
6
|
async function main() {
|
|
10
7
|
|
|
@@ -46,4 +43,6 @@ function processCwd() {
|
|
|
46
43
|
return process.cwd()
|
|
47
44
|
.replace('/.grunt', '')
|
|
48
45
|
.replace('/.scripts', '');
|
|
49
|
-
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
module.exports = main;
|
package/Gruntfile.js
CHANGED
|
@@ -5,6 +5,7 @@ module.exports = function(grunt) {
|
|
|
5
5
|
//compress: 'grunt-contrib-compress',
|
|
6
6
|
clean: 'grunt-contrib-clean'
|
|
7
7
|
});
|
|
8
|
+
grunt.option('force', true);
|
|
8
9
|
|
|
9
10
|
// -- Load modules
|
|
10
11
|
grunt.loadNpmTasks('grunt-contrib-cssmin');
|
|
@@ -14,10 +15,33 @@ module.exports = function(grunt) {
|
|
|
14
15
|
grunt.loadNpmTasks('grunt-run');
|
|
15
16
|
require('./.grunt/build_styles_task')(grunt);
|
|
16
17
|
|
|
18
|
+
// -- Functions
|
|
19
|
+
function getCleanedCWD() {
|
|
20
|
+
const cwd = process.cwd();
|
|
21
|
+
let newCwd = cwd
|
|
22
|
+
.replace('/node_modules', '')
|
|
23
|
+
.replace('/vanilla-jet', '')
|
|
24
|
+
.replace('/.grunt', '');
|
|
25
|
+
//console.log('cwd: ', newCwd);
|
|
26
|
+
return newCwd;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
// -- Vars
|
|
31
|
+
const cssDestination = `${getCleanedCWD()}/public/styles/app.min.css`;
|
|
32
|
+
const cssOrigin = `${getCleanedCWD()}/assets/styles/less/admin_build.less`;
|
|
33
|
+
const jsDestination = `${getCleanedCWD()}/public/`;
|
|
34
|
+
|
|
35
|
+
// -- Init
|
|
17
36
|
grunt.initConfig({
|
|
18
37
|
clean: {
|
|
19
|
-
build: [
|
|
20
|
-
minified: [
|
|
38
|
+
build: [`${getCleanedCWD()}/public/scripts/vanilla.min.js`],
|
|
39
|
+
minified: [
|
|
40
|
+
`${getCleanedCWD()}/public/scripts/api`,
|
|
41
|
+
`${getCleanedCWD()}/public/scripts/controllers`,
|
|
42
|
+
`${getCleanedCWD()}/public/scripts/views`,
|
|
43
|
+
`${getCleanedCWD()}/public/scripts/app.min.js`
|
|
44
|
+
],
|
|
21
45
|
//minified: ['public/scripts/**/*.min.js', 'public/scripts/*', '!public/scripts/vanilla.min.js']
|
|
22
46
|
},
|
|
23
47
|
less: {
|
|
@@ -29,7 +53,7 @@ module.exports = function(grunt) {
|
|
|
29
53
|
strictImports: true
|
|
30
54
|
},
|
|
31
55
|
files: {
|
|
32
|
-
|
|
56
|
+
[cssDestination] : cssOrigin
|
|
33
57
|
},
|
|
34
58
|
}
|
|
35
59
|
},
|
|
@@ -39,10 +63,10 @@ module.exports = function(grunt) {
|
|
|
39
63
|
},
|
|
40
64
|
styles: {
|
|
41
65
|
files: [
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
66
|
+
`${getCleanedCWD()}/assets/styles/less/*.less`,
|
|
67
|
+
`${getCleanedCWD()}/assets/styles/less/**/*.less`,
|
|
68
|
+
`${getCleanedCWD()}/assets/styles/less/**/**/*.less`,
|
|
69
|
+
`${getCleanedCWD()}/!assets/styles/less/admin_build.less`
|
|
46
70
|
],
|
|
47
71
|
tasks: ['buildLess'],
|
|
48
72
|
options: {
|
|
@@ -51,17 +75,21 @@ module.exports = function(grunt) {
|
|
|
51
75
|
},
|
|
52
76
|
scripts: {
|
|
53
77
|
files: [
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
78
|
+
`${getCleanedCWD()}/assets/pages/*.html`,
|
|
79
|
+
`${getCleanedCWD()}/assets/templates/**/*.html`,
|
|
80
|
+
`${getCleanedCWD()}/assets/templates/**/**/*.html`,
|
|
81
|
+
`${getCleanedCWD()}/external/view/*.js`,
|
|
82
|
+
`${getCleanedCWD()}/external/*.js`,
|
|
83
|
+
`${getCleanedCWD()}/framework/*.js`
|
|
60
84
|
],
|
|
61
85
|
tasks: ['shell:compileTemplates']
|
|
62
86
|
},
|
|
63
87
|
specificScripts: {
|
|
64
|
-
files: [
|
|
88
|
+
files: [
|
|
89
|
+
`${getCleanedCWD()}/assets/scripts/*.js`,
|
|
90
|
+
`${getCleanedCWD()}/assets/scripts/**/*.js`,
|
|
91
|
+
`${getCleanedCWD()}/assets/scripts/**/**/*.js`
|
|
92
|
+
],
|
|
65
93
|
tasks: ['uglify', 'clean:build', 'concat', 'clean:minified']
|
|
66
94
|
}
|
|
67
95
|
},
|
|
@@ -86,20 +114,21 @@ module.exports = function(grunt) {
|
|
|
86
114
|
files: [{
|
|
87
115
|
expand: true,
|
|
88
116
|
src: [
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
117
|
+
`${getCleanedCWD()}/assets/scripts/*.js`,
|
|
118
|
+
`${getCleanedCWD()}/assets/scripts/**/*.js`,
|
|
119
|
+
`${getCleanedCWD()}/assets/scripts/**/**/*.js`,
|
|
120
|
+
`${getCleanedCWD()}/assets/scripts/**/**/**/*.js`
|
|
93
121
|
],
|
|
94
|
-
dest: 'public
|
|
95
|
-
cwd: '',
|
|
122
|
+
dest: getCleanedCWD() + '/public',
|
|
96
123
|
rename : function (dest, src) {
|
|
97
124
|
|
|
98
125
|
var folder = src.substring(0, src.lastIndexOf('/')),
|
|
99
126
|
filename = src.substring(src.lastIndexOf('/'), src.length);
|
|
100
127
|
filename = filename.substring(0, filename.lastIndexOf('.'));
|
|
101
|
-
folder = folder.replaceAll('assets', '');
|
|
102
|
-
|
|
128
|
+
folder = folder.replaceAll('assets/', 'public/');
|
|
129
|
+
let file = folder + filename + '.min.js';
|
|
130
|
+
//console.log('file: ', file);
|
|
131
|
+
return file;
|
|
103
132
|
}
|
|
104
133
|
}]
|
|
105
134
|
}
|
|
@@ -108,17 +137,17 @@ module.exports = function(grunt) {
|
|
|
108
137
|
build: {
|
|
109
138
|
src: [
|
|
110
139
|
// Order
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
140
|
+
`${getCleanedCWD()}/public/scripts/controllers/**/*.min.js`,
|
|
141
|
+
`${getCleanedCWD()}/public/scripts/views/**/*.min.js`,
|
|
142
|
+
`${getCleanedCWD()}/public/scripts/api/**/*.min.js`,
|
|
143
|
+
`${getCleanedCWD()}/public/scripts/*.min.js`,
|
|
115
144
|
|
|
116
145
|
// Ignore files
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
146
|
+
`!${getCleanedCWD()}/public/scripts/core/**`,
|
|
147
|
+
`!${getCleanedCWD()}/public/scripts/plugins/**`,
|
|
148
|
+
`!${getCleanedCWD()}/public/scripts/plugins/ui/**`
|
|
120
149
|
],
|
|
121
|
-
dest:
|
|
150
|
+
dest: `${getCleanedCWD()}/public/scripts/vanilla.min.js`
|
|
122
151
|
}
|
|
123
152
|
},
|
|
124
153
|
compress: {
|
|
@@ -128,7 +157,7 @@ module.exports = function(grunt) {
|
|
|
128
157
|
},
|
|
129
158
|
files: [{
|
|
130
159
|
expand: true,
|
|
131
|
-
src: [
|
|
160
|
+
src: [`${getCleanedCWD()}/public/scripts/vanilla.min.js`],
|
|
132
161
|
dest: '',
|
|
133
162
|
ext: '.min.js.gz'
|
|
134
163
|
}]
|
|
@@ -141,7 +170,11 @@ module.exports = function(grunt) {
|
|
|
141
170
|
}
|
|
142
171
|
});
|
|
143
172
|
|
|
144
|
-
grunt.registerTask('
|
|
145
|
-
|
|
173
|
+
grunt.registerTask('cleanForce', function(target) {
|
|
174
|
+
grunt.option('force', true);
|
|
175
|
+
grunt.task.run('clean:' + target);
|
|
176
|
+
});
|
|
177
|
+
grunt.registerTask('default', ['buildLess', 'uglify', 'cleanForce:build', 'concat', 'cleanForce:minified', 'shell:compileTemplates', 'watch']);
|
|
178
|
+
grunt.registerTask('build', ['buildLess', 'uglify', 'cleanForce:build', 'concat', 'cleanForce:minified', 'shell:compileTemplates']);
|
|
146
179
|
grunt.registerTask('server', ['buildLess']);
|
|
147
180
|
};
|
package/bin.js
CHANGED
|
@@ -1,9 +1,38 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
const path = require('path');
|
|
4
|
+
const args = process.argv.slice(2);
|
|
5
|
+
const { execSync } = require('child_process');
|
|
4
6
|
|
|
5
|
-
const
|
|
6
|
-
require(generate_packes_script_path);
|
|
7
|
+
const generatePackagesJson = require(path.join(__dirname, './.scripts/generate_packages_json.js'));
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
switch (args[0]) {
|
|
10
|
+
|
|
11
|
+
case 'setup':
|
|
12
|
+
generatePackagesJson();
|
|
13
|
+
break;
|
|
14
|
+
|
|
15
|
+
case 'dev':
|
|
16
|
+
try {
|
|
17
|
+
execSync('grunt --env=development', { stdio: 'inherit', cwd: __dirname });
|
|
18
|
+
} catch (error) {
|
|
19
|
+
console.error('Error ejecutando grunt:', error.message);
|
|
20
|
+
}
|
|
21
|
+
break;
|
|
22
|
+
|
|
23
|
+
case 'qa':
|
|
24
|
+
try {
|
|
25
|
+
execSync('grunt --env=qa', { stdio: 'inherit', cwd: __dirname });
|
|
26
|
+
} catch (error) {
|
|
27
|
+
console.error('Error ejecutando grunt:', error.message);
|
|
28
|
+
}
|
|
29
|
+
break;
|
|
30
|
+
|
|
31
|
+
case 'prod':
|
|
32
|
+
try {
|
|
33
|
+
execSync('grunt --env=production', { stdio: 'inherit', cwd: __dirname });
|
|
34
|
+
} catch (error) {
|
|
35
|
+
console.error('Error ejecutando grunt:', error.message);
|
|
36
|
+
}
|
|
37
|
+
break;
|
|
38
|
+
}
|
package/framework/dipper.js
CHANGED
|
@@ -566,9 +566,12 @@ Dipper.prototype.includeEnvironment = function() {
|
|
|
566
566
|
// -- Helpers
|
|
567
567
|
Dipper.prototype.processCwd = function() {
|
|
568
568
|
|
|
569
|
-
|
|
569
|
+
let cwd = process.cwd()
|
|
570
570
|
.replace('/.grunt', '')
|
|
571
|
-
.replace('/.scripts', '')
|
|
571
|
+
.replace('/.scripts', '')
|
|
572
|
+
.replace('/node_modules', '')
|
|
573
|
+
.replace('/vanilla-jet', '');
|
|
574
|
+
return cwd;
|
|
572
575
|
}
|
|
573
576
|
|
|
574
577
|
Dipper.prototype.openJsonFile = function(fileName) {
|
package/framework/functions.js
CHANGED
|
@@ -18,7 +18,7 @@ class Functions {
|
|
|
18
18
|
let json = dipper.openJsonFile('vanillaJet.package.json');
|
|
19
19
|
|
|
20
20
|
// -- Google Fonts
|
|
21
|
-
if (json.fonts &&
|
|
21
|
+
if (json.fonts && json.fonts.length > 0) {
|
|
22
22
|
dipper.registerStyle('google-fonts', dipper.get_google_fonts(json.fonts));
|
|
23
23
|
}
|
|
24
24
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vanilla-jet",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.29",
|
|
4
4
|
"description": "VannilaJet framework",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
"dev": "grunt --env=development",
|
|
12
12
|
"build:qa": "grunt build --env=qa",
|
|
13
13
|
"build:prod": "grunt build --env=production",
|
|
14
|
-
"start": "pm2 start index.js -- --p production",
|
|
15
14
|
"test": "npm run test"
|
|
16
15
|
},
|
|
17
16
|
"repository": {
|
|
@@ -37,9 +36,7 @@
|
|
|
37
36
|
"minimist": "1.2.6",
|
|
38
37
|
"nunjucks": "3.2.4",
|
|
39
38
|
"underscore": ">= 1.12.x",
|
|
40
|
-
"zlib": "1.0.5"
|
|
41
|
-
},
|
|
42
|
-
"devDependencies": {
|
|
39
|
+
"zlib": "1.0.5",
|
|
43
40
|
"grunt": "1.6.1",
|
|
44
41
|
"grunt-cli": "1.4.3",
|
|
45
42
|
"grunt-contrib-clean": "2.0.1",
|