Skip to content

Instantly share code, notes, and snippets.

View davidnguyen11's full-sized avatar
๐Ÿ‘‹

David Nguyen davidnguyen11

๐Ÿ‘‹
View GitHub Profile
var fs = require('fs');
var mv = require('mv');
var dirs = ['app/.next/_next', 'app/.next/_next/build', 'app/.next/_next/build/page', 'app/.next/_next/static'];
const PAGE_PATH = {
old: 'app/.next/bundles/pages',
new: 'app/.next/_next/build/page'
};
const STATIC_PATH = {
{
"scripts": {
"s3:upload": "node ./deployment/s3",
"start": "node ./server",
"build": "next build app",
"postbuild": "node ./deployment/post-build"
},
}
stages:
- dockerize
- s3
- deploy
dockerize:
stage: dockerize
script:
- <DOCKERIZE_DO_SOMETHING>
s3:
stage: s3
const version = require('package.json').version;
const config = {
development: {
assetPrefix: ''
},
staging: {
assetPrefix: `https://static.com/CHOTOT_VEHICLE_STAGING/${version}`
},
production: {
var path = require('path');
var version = require('./package.json').version;
var Uploader = require('s3-uploading').default;
var env = (process.env.NODE_ENV || 'staging').toUpperCase();
var BUCKET_PATH = `<YOUR_BUCKET_NAME>_${env}/${version}`; // CHOTOT_VEHICLE_PRODUCTION/1.0.1
const options = {
s3: {
accessKeyId: process.env.CDN_ACCESS_KEY_ID,

Prepare

Create directory locale. Create 3 files below.

index.ts

import { getI18n } from '../i18n';

export const i18n = getI18n({
 messages: locale =&gt; require(`./locale.${locale}.json`)
function getDaysInMonth(month, year) {
return new Date(year, month, 0).getDate();
}
function getIntervals(year) {
const months = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
let min = 0;
let max = 0;
return months.map(month => {
import 'isomorphic-fetch'
function handleData(response) {
return new Promise((resolve, reject) => {
console.log(response)
const status = response.status
return response.json().then(data => {
const result = {
import React, { Component } from 'react';
import { Field, initialize } from 'redux-form';

import withForm from 'withForm';

const FORM_NAME = 'registerForm';
const Form = withForm(FORM_NAME);

class Filter extends Component {
SELECT array_to_json(array_agg(r), FALSE) as abc FROM <table_name> AS r;