Skip to content

Commit e0d24bb

Browse files
committed
Sync with the pdk
1 parent 54e5867 commit e0d24bb

8 files changed

+789
-361
lines changed

.editorconfig

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Stop the editor from looking for .editorconfig files in the parent directories
2+
root = true
3+
4+
[*]
5+
# Non-configurable Prettier behaviors
6+
charset = utf-8
7+
insert_final_newline = true
8+
trim_trailing_whitespace = true
9+
10+
# Configurable Prettier behaviors
11+
# (change these if your Prettier config differs)
12+
end_of_line = lf
13+
indent_style = space
14+
indent_size = 2
15+
max_line_length = 80

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,3 @@ TEST-results.xml
6565
package.g.props
6666
*v8.log
6767
/lib/
68-
packages.lock.json

eslint.config.mjs

+20-20
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
import typescriptEslint from '@typescript-eslint/eslint-plugin'
2-
import stylisticEslintPluginJs from '@stylistic/eslint-plugin-js'
32
import tsParser from '@typescript-eslint/parser'
43

54
export default [
6-
{
7-
files: ["src/*.ts"],
8-
plugins: {
9-
'@typescript-eslint': typescriptEslint,
10-
'@stylistic/js': stylisticEslintPluginJs,
11-
},
5+
{
6+
files: ['src/*.ts'],
7+
plugins: {
8+
'@typescript-eslint': typescriptEslint,
9+
// '@stylistic/js': stylisticEslintPluginJs,
10+
},
1211

13-
languageOptions: {
14-
parser: tsParser,
15-
ecmaVersion: 'latest',
16-
sourceType: 'module',
17-
parserOptions: {
18-
project: 'tsconfig.json',
19-
},
20-
},
12+
languageOptions: {
13+
parser: tsParser,
14+
ecmaVersion: 'latest',
15+
sourceType: 'module',
16+
parserOptions: {
17+
project: 'tsconfig.json',
18+
},
19+
},
2120

22-
rules: {
23-
"indent": ['error', 2],
24-
"no-undef": "warn"
25-
},
26-
}]
21+
rules: {
22+
indent: ['error', 2],
23+
'no-undef': 'warn',
24+
},
25+
},
26+
]

gulpfile.mjs

+53-37
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import dotconfig from '@dotenvx/dotenvx'
22
import { deleteAsync } from 'del'
3-
import fs from 'fs'
43
import { dest, series, src, watch } from 'gulp'
54
import eslint from 'gulp-eslint-new'
65
import ts from 'gulp-typescript'
6+
import prettier from 'gulp-prettier'
7+
import minify from 'gulp-minify'
78

89
dotconfig.config()
910

@@ -13,14 +14,14 @@ dotconfig.config()
1314
* Different paths we use...
1415
*/
1516
const paths = {
16-
src: './src',
17-
dist: './dist',
18-
19-
/**
20-
* ACARS scripts/config directory. This, by default, points to the home directory
21-
* But you can change this to point to a local directory
22-
*/
23-
acars: process.env.ACARS_SCRIPTS_PATH,
17+
src: './src',
18+
dist: './dist',
19+
20+
/**
21+
* ACARS scripts/config directory. This, by default, points to the home directory
22+
* But you can change this to point to a local directory
23+
*/
24+
acars: process.env.ACARS_SCRIPTS_PATH,
2425
}
2526

2627
/**
@@ -29,16 +30,31 @@ const paths = {
2930
const tsProject = ts.createProject('tsconfig.json')
3031

3132
function build_ts() {
32-
return tsProject.src()
33-
.pipe(eslint())
34-
.pipe(eslint.failAfterError())
35-
.pipe(tsProject())
36-
.js.pipe(dest(paths.dist))
33+
let pipeline = tsProject.src()
34+
.pipe(eslint())
35+
.pipe(eslint.failAfterError())
36+
.pipe(tsProject())
37+
.js
38+
.pipe(prettier())
39+
40+
// Minify/mangle output
41+
/*
42+
pipeline = pipeline.pipe(minify({
43+
mangle: false,
44+
}))*/
45+
46+
pipeline = pipeline.pipe(dest(paths.dist))
47+
48+
return pipeline
3749
}
3850

51+
/**
52+
*
53+
* @returns {*}
54+
*/
3955
function copy_package() {
40-
return src([paths.src + '/package.json'])
41-
.pipe(dest(paths.dist))
56+
return src([paths.src + '/package.json'])
57+
.pipe(dest(paths.dist))
4258
}
4359

4460
/**
@@ -51,22 +67,22 @@ export const build = series(build_ts, copy_package)
5167
*
5268
*/
5369
export function copy() {
54-
console.log(`Copying files to ${paths.acars}`)
70+
console.log(`Copying files to ${paths.acars}`)
5571

56-
return src(['./**/*', '!node_modules/**/*'], { 'cwd': paths.dist })
57-
.pipe(dest(paths.acars))
72+
return src(['./**/*', '!node_modules/**/*'], { 'cwd': paths.dist })
73+
.pipe(dest(paths.acars))
5874
}
5975

6076
/**
6177
* The build steps that run from the csproj
6278
* Force the output path to go into our build directory
6379
*/
6480
export const csbuild = series(
65-
async () => {
66-
paths.acars = '../Content/config/default'
67-
},
68-
build,
69-
copy,
81+
async () => {
82+
paths.acars = '../Content/config/default'
83+
},
84+
build,
85+
copy,
7086
)
7187

7288
/**
@@ -80,26 +96,26 @@ function build_dist() {
8096
* Build a distribution zip file, which can be easily uploaded
8197
*/
8298
export const dist = series(
83-
build,
84-
build_dist,
99+
build,
100+
build_dist,
85101
)
86102

87103
/**
88104
* Watch the src folder for updates, compile them and then copy them
89105
* to the config directory. ACARS should auto-reload
90106
*/
91107
export async function testing() {
92-
watch('src/', {
93-
ignoreInitial: false,
94-
delay: 500,
95-
}, series(build, copy))
108+
watch('src/', {
109+
ignoreInitial: false,
110+
delay: 500,
111+
}, series(build, copy))
96112
}
97113

98114
/**
99115
* Watch the files and distribute them out
100116
*/
101117
export function watchFiles() {
102-
watch('src/', build)
118+
watch('src/', build)
103119
}
104120

105121
export { watchFiles as watch }
@@ -108,12 +124,12 @@ export { watchFiles as watch }
108124
* Clean up the /dest directory
109125
*/
110126
export async function clean() {
111-
try {
112-
await deleteAsync([paths.dist])
113-
await Promise.resolve()
114-
} catch (e) {
115-
console.log(e)
116-
}
127+
try {
128+
await deleteAsync([paths.dist])
129+
await Promise.resolve()
130+
} catch (e) {
131+
console.log(e)
132+
}
117133
}
118134

119135
/**

0 commit comments

Comments
 (0)