Skip to content

Commit

Permalink
Update for latest yamdbf indev / djs v12.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
zajrik committed Dec 14, 2020
1 parent e6bcd13 commit ea708d4
Show file tree
Hide file tree
Showing 11 changed files with 5,468 additions and 212 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/publish_indev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Publish Indev Build

on:
push:
branches:
- master

jobs:
build:
name: Publish
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v1

- name: Install Node v12
uses: actions/setup-node@v1
with:
node-version: 14
registry-url: https://registry.npmjs.org/

- name: Install dependencies
run: npm install

- name: Build package
run: npx gulp build

- name: Generate indev version
run: |
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor}}@users.noreply.github.com"
npm version $(cat package.json | grep -oP '"version": "\K[^"]+(?=")')-indev.$(git rev-parse --verify HEAD)
- name: Publish to NPM
run: npm publish --tag indev --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
17 changes: 17 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.github/*
.vscode/*
examples/*
src/*
scripts/*
test/*

.gitignore
.jsdoc.json
.travis.yml

config.json

gulpfile.js
yarn.lock
tsconfig.json
tslint.json
28 changes: 12 additions & 16 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"command": "gulp",
"isShellCommand": true,
"version": "2.0.0",
"command": "npx",
"type": "shell",
"tasks": [
{
"taskName": "build:vscode",
"args": [],
"isBuildCommand": true,
"label": "build:vscode",
"args": ["gulp", "build:vscode"],
"group": "build",
"isBackground": false,
"problemMatcher": [
"$lessCompile",
"$tsc",
"$jshint"
]
"problemMatcher": ["$tsc"]
},
{
"taskName": "tests",
"args": ["tests"],
"command": "gulp",
"isShellCommand": true
"label": "tests",
"args": ["gulp", "tests"],
"type": "shell",
"problemMatcher": ["$tsc"]
}
]
}
}
71 changes: 23 additions & 48 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,43 +1,24 @@
/* eslint-disable @typescript-eslint/typedef */
const gulp = require('gulp');
const gulp_ts = require('gulp-typescript');
const gulp_sourcemaps = require('gulp-sourcemaps');
const typescript = require('gulp-typescript');
const sourcemaps = require('gulp-sourcemaps');
const eslint = require('gulp-eslint');
const del = require('del');
const path = require('path');
const { execSync } = require('child_process');

const project = gulp_ts.createProject('tsconfig.json');
const project = typescript.createProject('tsconfig.json');

let _linter;
let _gulp_tslint;
let _tslint;
let _runSequence;

const runSequence = () => _runSequence = _runSequence || require('run-sequence');
const gulp_tslint = () => _gulp_tslint = _gulp_tslint || require('gulp-tslint');
const tslint = () => _tslint = _tslint || require('tslint');
const linter = () => _linter = _linter || tslint().Linter.createProgram('tsconfig.json');

gulp.task('default', ['build']);
gulp.task('build:vscode', cb => runSequence()('lint', 'build', cb));
gulp.task('gh-prebuild', cb => runSequence()('build', 'gh-prebuild-prepare', cb));

gulp.task('pause', cb => setTimeout(() => cb(), 1e3));
gulp.task('tests', cb => runSequence()('lint', 'build', 'pause', 'build:tests', cb));

gulp.task('lint', () => {
gulp.task('lint', () =>
gulp.src('src/**/*.ts')
.pipe(gulp_tslint()({
configuration: 'tslint.json',
formatter: 'prose',
program: linter()
}))
.pipe(gulp_tslint().report());
})
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError()));

gulp.task('build', () => {
gulp.task('build', () =>
{
del.sync(['bin/**/*.*']);
const tsCompile = gulp.src('src/**/*.ts')
.pipe(gulp_sourcemaps.init({ base: 'src' }))
.pipe(sourcemaps.init({ base: 'src' }))
.pipe(project());

tsCompile.pipe(gulp.dest('bin/'));
Expand All @@ -47,32 +28,26 @@ gulp.task('build', () => {
gulp.src('src/**/*.lang').pipe(gulp.dest('bin/'));

return tsCompile.js
.pipe(gulp_sourcemaps.write('.', { sourceRoot: '../src' }))
.pipe(sourcemaps.write('.', { sourceRoot: '../src' }))
.pipe(gulp.dest('bin/'));
});

gulp.task('gh-prebuild-prepare', () => {
del.sync([
'../prebuild/**',
'../prebuild/.*',
'!../prebuild',
'!../prebuild/.git',
'!../prebuild/.git/**'
], { force: true });
gulp.src('bin/**/*.*').pipe(gulp.dest('../prebuild/bin'));
gulp.src('package.json').pipe(gulp.dest('../prebuild'));
})

gulp.task('build:tests', () => {
gulp.task('build:tests', () =>
{
del.sync(['test/**/*.js']);
const tsCompile = gulp.src('test/**/*.ts')
.pipe(gulp_sourcemaps.init({ base: 'test' }))
.pipe(sourcemaps.init({ base: 'test' }))
.pipe(project());

tsCompile.pipe(gulp.dest('test/'));

return tsCompile.js
.pipe(gulp_sourcemaps.mapSources(sourcePath => path.join(__dirname, 'test', sourcePath)))
.pipe(gulp_sourcemaps.write())
.pipe(sourcemaps.mapSources(sourcePath => path.join(__dirname, 'test', sourcePath)))
.pipe(sourcemaps.write())
.pipe(gulp.dest('test/'));
});

gulp.task('default', gulp.series('build'));
gulp.task('build:vscode', gulp.series('lint', 'build'));
gulp.task('pause', cb => setTimeout(cb, 1e3));
gulp.task('tests', gulp.series('lint', 'build', 'pause', 'build:tests'));
Loading

0 comments on commit ea708d4

Please sign in to comment.