This commit is contained in:
christopher 2020-11-03 16:22:31 +05:30
Родитель 7f66350be9
Коммит b9aa27a157
5 изменённых файлов: 220 добавлений и 0 удалений

31
.github/workflows/node.js.yml поставляемый Normal file
Просмотреть файл

@ -0,0 +1,31 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node.js CI
on:
pull_request:
branches: [ master ]
types: [opened, closed, edited, synchronize]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install
run: npm i

47
.github/workflows/publish.js.yml поставляемый Normal file
Просмотреть файл

@ -0,0 +1,47 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node.js CI
on:
push:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: set environment variables
uses: allenevans/set-env@v1.0.0
with:
GIT_USER: ${{ secrets.WEB_GITLAB_USER }}
GIT_TOKEN: ${{ secrets.WEB_GITLAB_TOKEN }}
GIT_MAIL: ${{ secrets.USER_MAIL }}
- name: Install
run: npm i
- name: Get changed files
run: |
git diff --name-only HEAD^ HEAD
- name: Publish
run: npm run publish
env:
GIT_USER: ${{ secrets.WEB_GITLAB_USER }}
GIT_TOKEN: ${{ secrets.WEB_GITLAB_TOKEN }}
GIT_MAIL: ${{ secrets.USER_MAIL }}

8
.gitignore поставляемый
Просмотреть файл

@ -0,0 +1,8 @@
.npmrc
dist/
.vscode/
coverage/
index.js
index.d.ts
gulpfile.js
node_modules/

88
gulpfile.js Normal file
Просмотреть файл

@ -0,0 +1,88 @@
var fs = require('fs');
var gulp = require('gulp');
var glob = require('glob');
var shelljs = require('shelljs');
var path = require('path');
var branch = 'master';
var user = process.env.GIT_USER;
var token = process.env.GIT_TOKEN;
var user_mail = process.env.GIT_MAIL;
var is_temp = process.env.IS_TEMP;
var changedFileNames;
var changes;
/**
* Source shipping to gitlab
*/
gulp.task('ship-to-gitlab', function (done) {
changedFileNames = changedFileNameList();
console.log('--changedFileNames----' + changedFileNames);
var gitPath = 'https://' + user + ':' + token + `@gitlab.syncfusion.com/content/xamarin-docs`;
console.log('Clone has been started...!');
var clone = shelljs.exec('git clone ' + gitPath + ' -b ' + branch + ' ' + `../../../gitlabRepo/xamarin-docs`, {
silent: false
});
if (clone.code !== 0) {
console.log(clone.stderr);
done();
return;
} else {
console.log('Clone has been completed...!');
// update src from github to gitlab - replace files from cloned repo
for (var changedFileName of changedFileNames.split(',')) {
if (changedFileName !== null && changedFileName !== '') {
if (fs.existsSync('../xamarin-docs/' + changedFileName)) {
// It will update the modified files
if (fs.existsSync('../../../gitlabRepo/xamarin-docs/' + changedFileName)) {
shelljs.cp('-rf', `../xamarin-docs/` + changedFileName, `../../../gitlabRepo/xamarin-docs/` + changedFileName);
}
else {
// It will update the newly added files
if (fs.existsSync('../../../gitlabRepo/xamarin-docs/')) {
shelljs.cp('-rf', `../xamarin-docs/` + changedFileName, `../../../gitlabRepo/xamarin-docs/` + changedFileName);
}
}
}
else {
// It will remove the deleted files
if (fs.existsSync('../../../gitlabRepo/xamarin-docs/' + changedFileName)) {
shelljs.rm('-rf', `../../../gitlabRepo/xamarin-docs/` + changedFileName);
}
}
}
}
shelljs.cd(`../../../gitlabRepo/xamarin-docs`);
shelljs.exec('git add .');
shelljs.exec('git pull');
shelljs.exec('git commit -m \"source updation from github repo \" --no-verify');
shelljs.exec('git push');
shelljs.cd('../../');
}
})
// Controls List
function changedFileNameList() {
shelljs.exec(`git config --global user.email "${user_mail}"`);
shelljs.exec(`git config --global user.name "${user}"`);
changes = shelljs.exec(`git diff --name-status HEAD^ HEAD`);
var controls = '';
var changesList = changes.stdout.split('\n');
if (changesList !== null && changesList !== '') {
for (var comp of changesList) {
controls += comp.replace(/A\s+/g, "").replace(/M\s+/g, "").replace(/D\s+/g, "").replace(/R100\s+/g, "").split(/\s+/g) + ',';
}
return controls;
}
}

46
package.json Normal file
Просмотреть файл

@ -0,0 +1,46 @@
{
"name": "@Syncfusion/xamarin-docs",
"version": "1.0.0",
"description": "Syncfusion TypeScript common documentation",
"author": "Syncfusion Inc.",
"license": "UNLICENSED",
"dependencies": {
"core-js": "^2.5.7",
"cheerio": "^1.0.0-rc.2",
"gulp": "^3.9.1",
"gulp-csslint": "^1.0.1",
"gulp-csslint-report": "^2.0.0",
"gulp-gzip": "^1.4.2",
"lodash": "^4.17.11",
"markdownlint": "^0.11.0",
"markdown-link-extractor": "^1.2.0",
"markdown-spellcheck": "^1.3.1",
"prismjs": "^1.15.0",
"require-dir": "^1.0.0",
"shelljs": "^0.8.2",
"styled-components": "^3.4.9",
"typeface-merriweather": "0.0.43",
"typeface-montserrat": "0.0.43",
"typo-js": "^1.0.3",
"typescript": "^2.6.2",
"typography": "^0.16.17",
"typography-theme-wordpress-2016": "^0.15.10",
"webpack": "4.28.4",
"terser": "3.14.1"
},
"devDependencies": {
"eslint": "^4.19.1",
"eslint-plugin-react": "^7.11.1",
"gh-pages": "^1.2.0",
"json-loader": "^0.5.7",
"prettier": "^1.14.2"
},
"config": {
"ghooks": {
"pre-commit": "gulp test"
}
},
"scripts": {
"publish": "gulp ship-to-gitlab"
}
}